Skip to content

Commit d5660df

Browse files
committed
Merge branch 'akpm' (patches from Andrew)
Merge misc updates from Andrew Morton: "181 patches. Subsystems affected by this patch series: kbuild, scripts, ntfs, ocfs2, vfs, mm (slab, slub, kmemleak, dax, debug, pagecache, fadvise, gup, swap, memremap, memcg, selftests, pagemap, mincore, hmm, dma, memory-failure, vmallo and migration)" * emailed patches from Andrew Morton <akpm@linux-foundation.org>: (181 commits) mm/migrate: remove obsolete comment about device public mm/migrate: remove cpages-- in migrate_vma_finalize() mm, oom_adj: don't loop through tasks in __set_oom_adj when not necessary memblock: use separate iterators for memory and reserved regions memblock: implement for_each_reserved_mem_region() using __next_mem_region() memblock: remove unused memblock_mem_size() x86/setup: simplify reserve_crashkernel() x86/setup: simplify initrd relocation and reservation arch, drivers: replace for_each_membock() with for_each_mem_range() arch, mm: replace for_each_memblock() with for_each_mem_pfn_range() memblock: reduce number of parameters in for_each_mem_range() memblock: make memblock_debug and related functionality private memblock: make for_each_memblock_type() iterator private mircoblaze: drop unneeded NUMA and sparsemem initializations riscv: drop unneeded node initialization h8300, nds32, openrisc: simplify detection of memory extents arm64: numa: simplify dummy_numa_init() arm, xtensa: simplify initialization of high memory pages dma-contiguous: simplify cma_early_percent_memory() KVM: PPC: Book3S HV: simplify kvm_cma_reserve() ...
2 parents b5fc7a8 + f1f4f3a commit d5660df

192 files changed

Lines changed: 3918 additions & 2422 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.

.clang-format

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,11 +203,13 @@ ForEachMacros:
203203
- 'for_each_matching_node'
204204
- 'for_each_matching_node_and_match'
205205
- 'for_each_member'
206-
- 'for_each_memblock'
206+
- 'for_each_mem_region'
207207
- 'for_each_memblock_type'
208208
- 'for_each_memcg_cache_index'
209209
- 'for_each_mem_pfn_range'
210+
- '__for_each_mem_range'
210211
- 'for_each_mem_range'
212+
- '__for_each_mem_range_rev'
211213
- 'for_each_mem_range_rev'
212214
- 'for_each_migratetype_order'
213215
- 'for_each_msi_entry'
@@ -271,6 +273,7 @@ ForEachMacros:
271273
- 'for_each_registered_fb'
272274
- 'for_each_requested_gpio'
273275
- 'for_each_requested_gpio_in_range'
276+
- 'for_each_reserved_mem_range'
274277
- 'for_each_reserved_mem_region'
275278
- 'for_each_rtd_codec_dais'
276279
- 'for_each_rtd_codec_dais_rollback'

Documentation/admin-guide/cgroup-v2.rst

Lines changed: 49 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1259,6 +1259,10 @@ PAGE_SIZE multiple when read back.
12591259
can show up in the middle. Don't rely on items remaining in a
12601260
fixed position; use the keys to look up specific values!
12611261

1262+
If the entry has no per-node counter(or not show in the
1263+
mempry.numa_stat). We use 'npn'(non-per-node) as the tag
1264+
to indicate that it will not show in the mempry.numa_stat.
1265+
12621266
anon
12631267
Amount of memory used in anonymous mappings such as
12641268
brk(), sbrk(), and mmap(MAP_ANONYMOUS)
@@ -1270,15 +1274,11 @@ PAGE_SIZE multiple when read back.
12701274
kernel_stack
12711275
Amount of memory allocated to kernel stacks.
12721276

1273-
slab
1274-
Amount of memory used for storing in-kernel data
1275-
structures.
1276-
1277-
percpu
1277+
percpu(npn)
12781278
Amount of memory used for storing per-cpu kernel
12791279
data structures.
12801280

1281-
sock
1281+
sock(npn)
12821282
Amount of memory used in network transmission buffers
12831283

12841284
shmem
@@ -1318,11 +1318,9 @@ PAGE_SIZE multiple when read back.
13181318
Part of "slab" that cannot be reclaimed on memory
13191319
pressure.
13201320

1321-
pgfault
1322-
Total number of page faults incurred
1323-
1324-
pgmajfault
1325-
Number of major page faults incurred
1321+
slab(npn)
1322+
Amount of memory used for storing in-kernel data
1323+
structures.
13261324

13271325
workingset_refault_anon
13281326
Number of refaults of previously evicted anonymous pages.
@@ -1348,37 +1346,68 @@ PAGE_SIZE multiple when read back.
13481346
workingset_nodereclaim
13491347
Number of times a shadow node has been reclaimed
13501348

1351-
pgrefill
1349+
pgfault(npn)
1350+
Total number of page faults incurred
1351+
1352+
pgmajfault(npn)
1353+
Number of major page faults incurred
1354+
1355+
pgrefill(npn)
13521356
Amount of scanned pages (in an active LRU list)
13531357

1354-
pgscan
1358+
pgscan(npn)
13551359
Amount of scanned pages (in an inactive LRU list)
13561360

1357-
pgsteal
1361+
pgsteal(npn)
13581362
Amount of reclaimed pages
13591363

1360-
pgactivate
1364+
pgactivate(npn)
13611365
Amount of pages moved to the active LRU list
13621366

1363-
pgdeactivate
1367+
pgdeactivate(npn)
13641368
Amount of pages moved to the inactive LRU list
13651369

1366-
pglazyfree
1370+
pglazyfree(npn)
13671371
Amount of pages postponed to be freed under memory pressure
13681372

1369-
pglazyfreed
1373+
pglazyfreed(npn)
13701374
Amount of reclaimed lazyfree pages
13711375

1372-
thp_fault_alloc
1376+
thp_fault_alloc(npn)
13731377
Number of transparent hugepages which were allocated to satisfy
13741378
a page fault. This counter is not present when CONFIG_TRANSPARENT_HUGEPAGE
13751379
is not set.
13761380

1377-
thp_collapse_alloc
1381+
thp_collapse_alloc(npn)
13781382
Number of transparent hugepages which were allocated to allow
13791383
collapsing an existing range of pages. This counter is not
13801384
present when CONFIG_TRANSPARENT_HUGEPAGE is not set.
13811385

1386+
memory.numa_stat
1387+
A read-only nested-keyed file which exists on non-root cgroups.
1388+
1389+
This breaks down the cgroup's memory footprint into different
1390+
types of memory, type-specific details, and other information
1391+
per node on the state of the memory management system.
1392+
1393+
This is useful for providing visibility into the NUMA locality
1394+
information within an memcg since the pages are allowed to be
1395+
allocated from any physical node. One of the use case is evaluating
1396+
application performance by combining this information with the
1397+
application's CPU allocation.
1398+
1399+
All memory amounts are in bytes.
1400+
1401+
The output format of memory.numa_stat is::
1402+
1403+
type N0=<bytes in node 0> N1=<bytes in node 1> ...
1404+
1405+
The entries are ordered to be human readable, and new entries
1406+
can show up in the middle. Don't rely on items remaining in a
1407+
fixed position; use the keys to look up specific values!
1408+
1409+
The entries can refer to the memory.stat.
1410+
13821411
memory.swap.current
13831412
A read-only single value file which exists on non-root
13841413
cgroups.

Documentation/admin-guide/mm/hugetlbpage.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ hugepages
131131
parameter is preceded by an invalid hugepagesz parameter, it will
132132
be ignored.
133133
default_hugepagesz
134-
pecify the default huge page size. This parameter can
134+
Specify the default huge page size. This parameter can
135135
only be specified once on the command line. default_hugepagesz can
136136
optionally be followed by the hugepages parameter to preallocate a
137137
specific number of huge pages of default size. The number of default

Documentation/dev-tools/kasan.rst

Lines changed: 72 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ KASAN uses compile-time instrumentation to insert validity checks before every
1313
memory access, and therefore requires a compiler version that supports that.
1414

1515
Generic KASAN is supported in both GCC and Clang. With GCC it requires version
16-
8.3.0 or later. With Clang it requires version 7.0.0 or later, but detection of
16+
8.3.0 or later. Any supported Clang version is compatible, but detection of
1717
out-of-bounds accesses for global variables is only supported since Clang 11.
1818

19-
Tag-based KASAN is only supported in Clang and requires version 7.0.0 or later.
19+
Tag-based KASAN is only supported in Clang.
2020

2121
Currently generic KASAN is supported for the x86_64, arm64, xtensa, s390 and
2222
riscv architectures, and tag-based KASAN is supported only for arm64.
@@ -281,3 +281,73 @@ unmapped. This will require changes in arch-specific code.
281281

282282
This allows ``VMAP_STACK`` support on x86, and can simplify support of
283283
architectures that do not have a fixed module region.
284+
285+
CONFIG_KASAN_KUNIT_TEST & CONFIG_TEST_KASAN_MODULE
286+
--------------------------------------------------
287+
288+
``CONFIG_KASAN_KUNIT_TEST`` utilizes the KUnit Test Framework for testing.
289+
This means each test focuses on a small unit of functionality and
290+
there are a few ways these tests can be run.
291+
292+
Each test will print the KASAN report if an error is detected and then
293+
print the number of the test and the status of the test:
294+
295+
pass::
296+
297+
ok 28 - kmalloc_double_kzfree
298+
or, if kmalloc failed::
299+
300+
# kmalloc_large_oob_right: ASSERTION FAILED at lib/test_kasan.c:163
301+
Expected ptr is not null, but is
302+
not ok 4 - kmalloc_large_oob_right
303+
or, if a KASAN report was expected, but not found::
304+
305+
# kmalloc_double_kzfree: EXPECTATION FAILED at lib/test_kasan.c:629
306+
Expected kasan_data->report_expected == kasan_data->report_found, but
307+
kasan_data->report_expected == 1
308+
kasan_data->report_found == 0
309+
not ok 28 - kmalloc_double_kzfree
310+
311+
All test statuses are tracked as they run and an overall status will
312+
be printed at the end::
313+
314+
ok 1 - kasan
315+
316+
or::
317+
318+
not ok 1 - kasan
319+
320+
(1) Loadable Module
321+
~~~~~~~~~~~~~~~~~~~~
322+
323+
With ``CONFIG_KUNIT`` enabled, ``CONFIG_KASAN_KUNIT_TEST`` can be built as
324+
a loadable module and run on any architecture that supports KASAN
325+
using something like insmod or modprobe. The module is called ``test_kasan``.
326+
327+
(2) Built-In
328+
~~~~~~~~~~~~~
329+
330+
With ``CONFIG_KUNIT`` built-in, ``CONFIG_KASAN_KUNIT_TEST`` can be built-in
331+
on any architecure that supports KASAN. These and any other KUnit
332+
tests enabled will run and print the results at boot as a late-init
333+
call.
334+
335+
(3) Using kunit_tool
336+
~~~~~~~~~~~~~~~~~~~~~
337+
338+
With ``CONFIG_KUNIT`` and ``CONFIG_KASAN_KUNIT_TEST`` built-in, we can also
339+
use kunit_tool to see the results of these along with other KUnit
340+
tests in a more readable way. This will not print the KASAN reports
341+
of tests that passed. Use `KUnit documentation <https://www.kernel.org/doc/html/latest/dev-tools/kunit/index.html>`_ for more up-to-date
342+
information on kunit_tool.
343+
344+
.. _KUnit: https://www.kernel.org/doc/html/latest/dev-tools/kunit/index.html
345+
346+
``CONFIG_TEST_KASAN_MODULE`` is a set of KASAN tests that could not be
347+
converted to KUnit. These tests can be run only as a module with
348+
``CONFIG_TEST_KASAN_MODULE`` built as a loadable module and
349+
``CONFIG_KASAN`` built-in. The type of error expected and the
350+
function being run is printed before the expression expected to give
351+
an error. Then the error is printed, if found, and that test
352+
should be interpretted to pass only if the error was the one expected
353+
by the test.

Documentation/dev-tools/kmemleak.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ Testing with kmemleak-test
229229

230230
To check if you have all set up to use kmemleak, you can use the kmemleak-test
231231
module, a module that deliberately leaks memory. Set CONFIG_DEBUG_KMEMLEAK_TEST
232-
as module (it can't be used as bult-in) and boot the kernel with kmemleak
232+
as module (it can't be used as built-in) and boot the kernel with kmemleak
233233
enabled. Load the module and perform a scan with::
234234

235235
# modprobe kmemleak-test

Documentation/kbuild/makefiles.rst

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ This document describes the Linux kernel Makefiles.
2121
--- 3.10 Special Rules
2222
--- 3.11 $(CC) support functions
2323
--- 3.12 $(LD) support functions
24+
--- 3.13 Script Invocation
2425
2526
=== 4 Host Program support
2627
--- 4.1 Simple Host Program
@@ -605,6 +606,25 @@ more details, with real examples.
605606
#Makefile
606607
LDFLAGS_vmlinux += $(call ld-option, -X)
607608

609+
3.13 Script invocation
610+
----------------------
611+
612+
Make rules may invoke scripts to build the kernel. The rules shall
613+
always provide the appropriate interpreter to execute the script. They
614+
shall not rely on the execute bits being set, and shall not invoke the
615+
script directly. For the convenience of manual script invocation, such
616+
as invoking ./scripts/checkpatch.pl, it is recommended to set execute
617+
bits on the scripts nonetheless.
618+
619+
Kbuild provides variables $(CONFIG_SHELL), $(AWK), $(PERL),
620+
$(PYTHON) and $(PYTHON3) to refer to interpreters for the respective
621+
scripts.
622+
623+
Example::
624+
625+
#Makefile
626+
cmd_depmod = $(CONFIG_SHELL) $(srctree)/scripts/depmod.sh $(DEPMOD) \
627+
$(KERNELRELEASE)
608628

609629
4 Host Program support
610630
======================

Documentation/vm/active_mm.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ Active MM
6464
actually get cases where you have a address space that is _only_ used by
6565
lazy users. That is often a short-lived state, because once that thread
6666
gets scheduled away in favour of a real thread, the "zombie" mm gets
67-
released because "mm_users" becomes zero.
67+
released because "mm_count" becomes zero.
6868

6969
Also, a new rule is that _nobody_ ever has "init_mm" as a real MM any
7070
more. "init_mm" should be considered just a "lazy context when no other

Documentation/x86/x86_64/boot-options.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,10 @@ NUMA
173173
numa=noacpi
174174
Don't parse the SRAT table for NUMA setup
175175

176+
numa=nohmat
177+
Don't parse the HMAT table for NUMA setup, or soft-reserved memory
178+
partitioning.
179+
176180
numa=fake=<size>[MG]
177181
If given as a memory unit, fills all system RAM with nodes of
178182
size interleaved over physical nodes.

MAINTAINERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9727,8 +9727,8 @@ M: Catalin Marinas <catalin.marinas@arm.com>
97279727
S: Maintained
97289728
F: Documentation/dev-tools/kmemleak.rst
97299729
F: include/linux/kmemleak.h
9730-
F: mm/kmemleak-test.c
97319730
F: mm/kmemleak.c
9731+
F: samples/kmemleak/kmemleak-test.c
97329732

97339733
KMOD KERNEL MODULE LOADER - USERMODE HELPER
97349734
M: Luis Chamberlain <mcgrof@kernel.org>

Makefile

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -921,15 +921,6 @@ KBUILD_CFLAGS += $(call cc-disable-warning, maybe-uninitialized)
921921
# disable invalid "can't wrap" optimizations for signed / pointers
922922
KBUILD_CFLAGS += $(call cc-option,-fno-strict-overflow)
923923

924-
# clang sets -fmerge-all-constants by default as optimization, but this
925-
# is non-conforming behavior for C and in fact breaks the kernel, so we
926-
# need to disable it here generally.
927-
KBUILD_CFLAGS += $(call cc-option,-fno-merge-all-constants)
928-
929-
# for gcc -fno-merge-all-constants disables everything, but it is fine
930-
# to have actual conforming behavior enabled.
931-
KBUILD_CFLAGS += $(call cc-option,-fmerge-constants)
932-
933924
# Make sure -fstack-check isn't enabled (like gentoo apparently did)
934925
KBUILD_CFLAGS += $(call cc-option,-fno-stack-check,)
935926

0 commit comments

Comments
 (0)