Skip to content

Commit 00170fd

Browse files
committed
Merge branch 'akpm' (patchbomb from Andrew) into next
Merge misc updates from Andrew Morton: - a few fixes for 3.16. Cc'ed to stable so they'll get there somehow. - various misc fixes and cleanups - most of the ocfs2 queue. Review is slow... - most of MM. The MM queue is pretty huge this time, but not much in the way of feature work. - some tweaks under kernel/ - printk maintenance work - updates to lib/ - checkpatch updates - tweaks to init/ * emailed patches from Andrew Morton <akpm@linux-foundation.org>: (276 commits) fs/autofs4/dev-ioctl.c: add __init to autofs_dev_ioctl_init fs/ncpfs/getopt.c: replace simple_strtoul by kstrtoul init/main.c: remove an ifdef kthreads: kill CLONE_KERNEL, change kernel_thread(kernel_init) to avoid CLONE_SIGHAND init/main.c: add initcall_blacklist kernel parameter init/main.c: don't use pr_debug() fs/binfmt_flat.c: make old_reloc() static fs/binfmt_elf.c: fix bool assignements fs/efs: convert printk(KERN_DEBUG to pr_debug fs/efs: add pr_fmt / use __func__ fs/efs: convert printk to pr_foo() scripts/checkpatch.pl: device_initcall is not the only __initcall substitute checkpatch: check stable email address checkpatch: warn on unnecessary void function return statements checkpatch: prefer kstrto<foo> to sscanf(buf, "%<lhuidx>", &bar); checkpatch: add warning for kmalloc/kzalloc with multiply checkpatch: warn on #defines ending in semicolon checkpatch: make --strict a default for files in drivers/net and net/ checkpatch: always warn on missing blank line after variable declaration block checkpatch: fix wildcard DT compatible string checking ...
2 parents d09cc36 + 3ff6db3 commit 00170fd

279 files changed

Lines changed: 4712 additions & 3514 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎Documentation/CodingStyle‎

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -660,15 +660,23 @@ There are a number of driver model diagnostic macros in <linux/device.h>
660660
which you should use to make sure messages are matched to the right device
661661
and driver, and are tagged with the right level: dev_err(), dev_warn(),
662662
dev_info(), and so forth. For messages that aren't associated with a
663-
particular device, <linux/printk.h> defines pr_debug() and pr_info().
663+
particular device, <linux/printk.h> defines pr_notice(), pr_info(),
664+
pr_warn(), pr_err(), etc.
664665

665666
Coming up with good debugging messages can be quite a challenge; and once
666-
you have them, they can be a huge help for remote troubleshooting. Such
667-
messages should be compiled out when the DEBUG symbol is not defined (that
668-
is, by default they are not included). When you use dev_dbg() or pr_debug(),
669-
that's automatic. Many subsystems have Kconfig options to turn on -DDEBUG.
670-
A related convention uses VERBOSE_DEBUG to add dev_vdbg() messages to the
671-
ones already enabled by DEBUG.
667+
you have them, they can be a huge help for remote troubleshooting. However
668+
debug message printing is handled differently than printing other non-debug
669+
messages. While the other pr_XXX() functions print unconditionally,
670+
pr_debug() does not; it is compiled out by default, unless either DEBUG is
671+
defined or CONFIG_DYNAMIC_DEBUG is set. That is true for dev_dbg() also,
672+
and a related convention uses VERBOSE_DEBUG to add dev_vdbg() messages to
673+
the ones already enabled by DEBUG.
674+
675+
Many subsystems have Kconfig debug options to turn on -DDEBUG in the
676+
corresponding Makefile; in other cases specific files #define DEBUG. And
677+
when a debug message should be unconditionally printed, such as if it is
678+
already inside a debug-related #ifdef secton, printk(KERN_DEBUG ...) can be
679+
used.
672680

673681

674682
Chapter 14: Allocating memory

‎Documentation/cgroups/memory.txt‎

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,11 @@ When oom event notifier is registered, event will be delivered.
270270

271271
2.7 Kernel Memory Extension (CONFIG_MEMCG_KMEM)
272272

273+
WARNING: Current implementation lacks reclaim support. That means allocation
274+
attempts will fail when close to the limit even if there are plenty of
275+
kmem available for reclaim. That makes this option unusable in real
276+
life so DO NOT SELECT IT unless for development purposes.
277+
273278
With the Kernel memory extension, the Memory Controller is able to limit
274279
the amount of kernel memory used by the system. Kernel memory is fundamentally
275280
different than user memory, since it can't be swapped out, which makes it
@@ -535,17 +540,15 @@ Note:
535540

536541
5.3 swappiness
537542

538-
Similar to /proc/sys/vm/swappiness, but affecting a hierarchy of groups only.
543+
Similar to /proc/sys/vm/swappiness, but only affecting reclaim that is
544+
triggered by this cgroup's hard limit. The tunable in the root cgroup
545+
corresponds to the global swappiness setting.
546+
539547
Please note that unlike the global swappiness, memcg knob set to 0
540548
really prevents from any swapping even if there is a swap storage
541549
available. This might lead to memcg OOM killer if there are no file
542550
pages to reclaim.
543551

544-
Following cgroups' swappiness can't be changed.
545-
- root cgroup (uses /proc/sys/vm/swappiness).
546-
- a cgroup which uses hierarchy and it has other cgroup(s) below it.
547-
- a cgroup which uses hierarchy and not the root of hierarchy.
548-
549552
5.4 failcnt
550553

551554
A memory cgroup provides memory.failcnt and memory.memsw.failcnt files.
@@ -754,7 +757,6 @@ You can disable the OOM-killer by writing "1" to memory.oom_control file, as:
754757

755758
#echo 1 > memory.oom_control
756759

757-
This operation is only allowed to the top cgroup of a sub-hierarchy.
758760
If OOM-killer is disabled, tasks under cgroup will hang/sleep
759761
in memory cgroup's OOM-waitqueue when they request accountable memory.
760762

‎Documentation/kernel-parameters.txt‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -630,8 +630,11 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
630630
Also note the kernel might malfunction if you disable
631631
some critical bits.
632632

633-
cma=nn[MG] [ARM,KNL]
634-
Sets the size of kernel global memory area for contiguous
633+
cma=nn[MG]@[start[MG][-end[MG]]]
634+
[ARM,X86,KNL]
635+
Sets the size of kernel global memory area for
636+
contiguous memory allocations and optionally the
637+
placement constraint by the physical address range of
635638
memory allocations. For more information, see
636639
include/linux/dma-contiguous.h
637640

@@ -1309,6 +1312,10 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
13091312
for working out where the kernel is dying during
13101313
startup.
13111314

1315+
initcall_blacklist= [KNL] Do not execute a comma-separated list of
1316+
initcall functions. Useful for debugging built-in
1317+
modules and initcalls.
1318+
13121319
initrd= [BOOT] Specify the location of the initial ramdisk
13131320

13141321
inport.irq= [HW] Inport (ATI XL and Microsoft) busmouse driver

‎Documentation/memory-hotplug.txt‎

Lines changed: 61 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -88,16 +88,21 @@ phase by hand.
8888

8989
1.3. Unit of Memory online/offline operation
9090
------------
91-
Memory hotplug uses SPARSEMEM memory model. SPARSEMEM divides the whole memory
92-
into chunks of the same size. The chunk is called a "section". The size of
93-
a section is architecture dependent. For example, power uses 16MiB, ia64 uses
94-
1GiB. The unit of online/offline operation is "one section". (see Section 3.)
91+
Memory hotplug uses SPARSEMEM memory model which allows memory to be divided
92+
into chunks of the same size. These chunks are called "sections". The size of
93+
a memory section is architecture dependent. For example, power uses 16MiB, ia64
94+
uses 1GiB.
9595

96-
To determine the size of sections, please read this file:
96+
Memory sections are combined into chunks referred to as "memory blocks". The
97+
size of a memory block is architecture dependent and represents the logical
98+
unit upon which memory online/offline operations are to be performed. The
99+
default size of a memory block is the same as memory section size unless an
100+
architecture specifies otherwise. (see Section 3.)
101+
102+
To determine the size (in bytes) of a memory block please read this file:
97103

98104
/sys/devices/system/memory/block_size_bytes
99105

100-
This file shows the size of sections in byte.
101106

102107
-----------------------
103108
2. Kernel Configuration
@@ -123,42 +128,35 @@ config options.
123128
(CONFIG_ACPI_CONTAINER).
124129
This option can be kernel module too.
125130

131+
126132
--------------------------------
127-
4 sysfs files for memory hotplug
133+
3 sysfs files for memory hotplug
128134
--------------------------------
129-
All sections have their device information in sysfs. Each section is part of
130-
a memory block under /sys/devices/system/memory as
135+
All memory blocks have their device information in sysfs. Each memory block
136+
is described under /sys/devices/system/memory as
131137

132138
/sys/devices/system/memory/memoryXXX
133-
(XXX is the section id.)
139+
(XXX is the memory block id.)
134140

135-
Now, XXX is defined as (start_address_of_section / section_size) of the first
136-
section contained in the memory block. The files 'phys_index' and
137-
'end_phys_index' under each directory report the beginning and end section id's
138-
for the memory block covered by the sysfs directory. It is expected that all
141+
For the memory block covered by the sysfs directory. It is expected that all
139142
memory sections in this range are present and no memory holes exist in the
140143
range. Currently there is no way to determine if there is a memory hole, but
141144
the existence of one should not affect the hotplug capabilities of the memory
142145
block.
143146

144-
For example, assume 1GiB section size. A device for a memory starting at
147+
For example, assume 1GiB memory block size. A device for a memory starting at
145148
0x100000000 is /sys/device/system/memory/memory4
146149
(0x100000000 / 1Gib = 4)
147150
This device covers address range [0x100000000 ... 0x140000000)
148151

149-
Under each section, you can see 4 or 5 files, the end_phys_index file being
150-
a recent addition and not present on older kernels.
152+
Under each memory block, you can see 4 files:
151153

152-
/sys/devices/system/memory/memoryXXX/start_phys_index
153-
/sys/devices/system/memory/memoryXXX/end_phys_index
154+
/sys/devices/system/memory/memoryXXX/phys_index
154155
/sys/devices/system/memory/memoryXXX/phys_device
155156
/sys/devices/system/memory/memoryXXX/state
156157
/sys/devices/system/memory/memoryXXX/removable
157158

158-
'phys_index' : read-only and contains section id of the first section
159-
in the memory block, same as XXX.
160-
'end_phys_index' : read-only and contains section id of the last section
161-
in the memory block.
159+
'phys_index' : read-only and contains memory block id, same as XXX.
162160
'state' : read-write
163161
at read: contains online/offline state of memory.
164162
at write: user can specify "online_kernel",
@@ -185,6 +183,7 @@ For example:
185183
A backlink will also be created:
186184
/sys/devices/system/memory/memory9/node0 -> ../../node/node0
187185

186+
188187
--------------------------------
189188
4. Physical memory hot-add phase
190189
--------------------------------
@@ -227,11 +226,10 @@ You can tell the physical address of new memory to the kernel by
227226

228227
% echo start_address_of_new_memory > /sys/devices/system/memory/probe
229228

230-
Then, [start_address_of_new_memory, start_address_of_new_memory + section_size)
231-
memory range is hot-added. In this case, hotplug script is not called (in
232-
current implementation). You'll have to online memory by yourself.
233-
Please see "How to online memory" in this text.
234-
229+
Then, [start_address_of_new_memory, start_address_of_new_memory +
230+
memory_block_size] memory range is hot-added. In this case, hotplug script is
231+
not called (in current implementation). You'll have to online memory by
232+
yourself. Please see "How to online memory" in this text.
235233

236234

237235
------------------------------
@@ -240,36 +238,36 @@ Please see "How to online memory" in this text.
240238

241239
5.1. State of memory
242240
------------
243-
To see (online/offline) state of memory section, read 'state' file.
241+
To see (online/offline) state of a memory block, read 'state' file.
244242

245243
% cat /sys/device/system/memory/memoryXXX/state
246244

247245

248-
If the memory section is online, you'll read "online".
249-
If the memory section is offline, you'll read "offline".
246+
If the memory block is online, you'll read "online".
247+
If the memory block is offline, you'll read "offline".
250248

251249

252250
5.2. How to online memory
253251
------------
254252
Even if the memory is hot-added, it is not at ready-to-use state.
255-
For using newly added memory, you have to "online" the memory section.
253+
For using newly added memory, you have to "online" the memory block.
256254

257-
For onlining, you have to write "online" to the section's state file as:
255+
For onlining, you have to write "online" to the memory block's state file as:
258256

259257
% echo online > /sys/devices/system/memory/memoryXXX/state
260258

261-
This onlining will not change the ZONE type of the target memory section,
262-
If the memory section is in ZONE_NORMAL, you can change it to ZONE_MOVABLE:
259+
This onlining will not change the ZONE type of the target memory block,
260+
If the memory block is in ZONE_NORMAL, you can change it to ZONE_MOVABLE:
263261

264262
% echo online_movable > /sys/devices/system/memory/memoryXXX/state
265-
(NOTE: current limit: this memory section must be adjacent to ZONE_MOVABLE)
263+
(NOTE: current limit: this memory block must be adjacent to ZONE_MOVABLE)
266264

267-
And if the memory section is in ZONE_MOVABLE, you can change it to ZONE_NORMAL:
265+
And if the memory block is in ZONE_MOVABLE, you can change it to ZONE_NORMAL:
268266

269267
% echo online_kernel > /sys/devices/system/memory/memoryXXX/state
270-
(NOTE: current limit: this memory section must be adjacent to ZONE_NORMAL)
268+
(NOTE: current limit: this memory block must be adjacent to ZONE_NORMAL)
271269

272-
After this, section memoryXXX's state will be 'online' and the amount of
270+
After this, memory block XXX's state will be 'online' and the amount of
273271
available memory will be increased.
274272

275273
Currently, newly added memory is added as ZONE_NORMAL (for powerpc, ZONE_DMA).
@@ -284,22 +282,22 @@ This may be changed in future.
284282
6.1 Memory offline and ZONE_MOVABLE
285283
------------
286284
Memory offlining is more complicated than memory online. Because memory offline
287-
has to make the whole memory section be unused, memory offline can fail if
288-
the section includes memory which cannot be freed.
285+
has to make the whole memory block be unused, memory offline can fail if
286+
the memory block includes memory which cannot be freed.
289287

290288
In general, memory offline can use 2 techniques.
291289

292-
(1) reclaim and free all memory in the section.
293-
(2) migrate all pages in the section.
290+
(1) reclaim and free all memory in the memory block.
291+
(2) migrate all pages in the memory block.
294292

295293
In the current implementation, Linux's memory offline uses method (2), freeing
296-
all pages in the section by page migration. But not all pages are
294+
all pages in the memory block by page migration. But not all pages are
297295
migratable. Under current Linux, migratable pages are anonymous pages and
298-
page caches. For offlining a section by migration, the kernel has to guarantee
299-
that the section contains only migratable pages.
296+
page caches. For offlining a memory block by migration, the kernel has to
297+
guarantee that the memory block contains only migratable pages.
300298

301-
Now, a boot option for making a section which consists of migratable pages is
302-
supported. By specifying "kernelcore=" or "movablecore=" boot option, you can
299+
Now, a boot option for making a memory block which consists of migratable pages
300+
is supported. By specifying "kernelcore=" or "movablecore=" boot option, you can
303301
create ZONE_MOVABLE...a zone which is just used for movable pages.
304302
(See also Documentation/kernel-parameters.txt)
305303

@@ -315,28 +313,27 @@ creates ZONE_MOVABLE as following.
315313
Size of memory for movable pages (for offline) is ZZZZ.
316314

317315

318-
Note) Unfortunately, there is no information to show which section belongs
316+
Note: Unfortunately, there is no information to show which memory block belongs
319317
to ZONE_MOVABLE. This is TBD.
320318

321319

322320
6.2. How to offline memory
323321
------------
324-
You can offline a section by using the same sysfs interface that was used in
325-
memory onlining.
322+
You can offline a memory block by using the same sysfs interface that was used
323+
in memory onlining.
326324

327325
% echo offline > /sys/devices/system/memory/memoryXXX/state
328326

329-
If offline succeeds, the state of the memory section is changed to be "offline".
327+
If offline succeeds, the state of the memory block is changed to be "offline".
330328
If it fails, some error core (like -EBUSY) will be returned by the kernel.
331-
Even if a section does not belong to ZONE_MOVABLE, you can try to offline it.
332-
If it doesn't contain 'unmovable' memory, you'll get success.
329+
Even if a memory block does not belong to ZONE_MOVABLE, you can try to offline
330+
it. If it doesn't contain 'unmovable' memory, you'll get success.
333331

334-
A section under ZONE_MOVABLE is considered to be able to be offlined easily.
335-
But under some busy state, it may return -EBUSY. Even if a memory section
336-
cannot be offlined due to -EBUSY, you can retry offlining it and may be able to
337-
offline it (or not).
338-
(For example, a page is referred to by some kernel internal call and released
339-
soon.)
332+
A memory block under ZONE_MOVABLE is considered to be able to be offlined
333+
easily. But under some busy state, it may return -EBUSY. Even if a memory
334+
block cannot be offlined due to -EBUSY, you can retry offlining it and may be
335+
able to offline it (or not). (For example, a page is referred to by some kernel
336+
internal call and released soon.)
340337

341338
Consideration:
342339
Memory hotplug's design direction is to make the possibility of memory offlining
@@ -373,11 +370,11 @@ MEMORY_GOING_OFFLINE
373370
Generated to begin the process of offlining memory. Allocations are no
374371
longer possible from the memory but some of the memory to be offlined
375372
is still in use. The callback can be used to free memory known to a
376-
subsystem from the indicated memory section.
373+
subsystem from the indicated memory block.
377374

378375
MEMORY_CANCEL_OFFLINE
379376
Generated if MEMORY_GOING_OFFLINE fails. Memory is available again from
380-
the section that we attempted to offline.
377+
the memory block that we attempted to offline.
381378

382379
MEMORY_OFFLINE
383380
Generated after offlining memory is complete.
@@ -413,8 +410,8 @@ node if necessary.
413410
--------------
414411
- allowing memory hot-add to ZONE_MOVABLE. maybe we need some switch like
415412
sysctl or new control file.
416-
- showing memory section and physical device relationship.
417-
- showing memory section is under ZONE_MOVABLE or not
413+
- showing memory block and physical device relationship.
414+
- showing memory block is under ZONE_MOVABLE or not
418415
- test and make it better memory offlining.
419416
- support HugeTLB page migration and offlining.
420417
- memmap removing at memory offline.

‎Documentation/sysctl/vm.txt‎

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -746,8 +746,8 @@ Changing this takes effect whenever an application requests memory.
746746
vfs_cache_pressure
747747
------------------
748748

749-
Controls the tendency of the kernel to reclaim the memory which is used for
750-
caching of directory and inode objects.
749+
This percentage value controls the tendency of the kernel to reclaim
750+
the memory which is used for caching of directory and inode objects.
751751

752752
At the default value of vfs_cache_pressure=100 the kernel will attempt to
753753
reclaim dentries and inodes at a "fair" rate with respect to pagecache and
@@ -757,6 +757,11 @@ never reclaim dentries and inodes due to memory pressure and this can easily
757757
lead to out-of-memory conditions. Increasing vfs_cache_pressure beyond 100
758758
causes the kernel to prefer to reclaim dentries and inodes.
759759

760+
Increasing vfs_cache_pressure significantly beyond 100 may have negative
761+
performance impact. Reclaim code needs to take various locks to find freeable
762+
directory and inode objects. With vfs_cache_pressure=1000, it will look for
763+
ten times more freeable objects than there are.
764+
760765
==============================================================
761766

762767
zone_reclaim_mode:
@@ -772,16 +777,17 @@ This is value ORed together of
772777
2 = Zone reclaim writes dirty pages out
773778
4 = Zone reclaim swaps pages
774779

775-
zone_reclaim_mode is set during bootup to 1 if it is determined that pages
776-
from remote zones will cause a measurable performance reduction. The
777-
page allocator will then reclaim easily reusable pages (those page
778-
cache pages that are currently not used) before allocating off node pages.
779-
780-
It may be beneficial to switch off zone reclaim if the system is
781-
used for a file server and all of memory should be used for caching files
782-
from disk. In that case the caching effect is more important than
780+
zone_reclaim_mode is disabled by default. For file servers or workloads
781+
that benefit from having their data cached, zone_reclaim_mode should be
782+
left disabled as the caching effect is likely to be more important than
783783
data locality.
784784

785+
zone_reclaim may be enabled if it's known that the workload is partitioned
786+
such that each partition fits within a NUMA node and that accessing remote
787+
memory would cause a measurable performance reduction. The page allocator
788+
will then reclaim easily reusable pages (those page cache pages that are
789+
currently not used) before allocating off node pages.
790+
785791
Allowing zone reclaim to write out pages stops processes that are
786792
writing large amounts of data from dirtying pages on other nodes. Zone
787793
reclaim will write out dirty pages if a zone fills up and so effectively

0 commit comments

Comments
 (0)