5.11.7-rc1 review
Subsystems (4)
[email protected]
maintainerPATCH 303/306 mm/memcg: set memcg when splitting page
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Zhou Guanghui <[email protected]>
commit e1baddf8475b06cc56f4bafecf9a32a124343d9f upstream.
As described in the split_page() comment, for the non-compound high order page, the sub-pages must be freed individually. If the memcg of the first page is valid, the tail pages cannot be uncharged when be freed.
For example, when alloc_pages_exact is used to allocate 1MB continuous physical memory, 2MB is charged(kmemcg is enabled and __GFP_ACCOUNT is set). When make_alloc_exact free the unused 1MB and free_pages_exact free the applied 1MB, actually, only 4KB(one page) is uncharged.
Therefore, the memcg of the tail page needs to be set when splitting a page.
Michel:
There are at least two explicit users of __GFP_ACCOUNT with alloc_exact_pages added recently. See 7efe8ef274024 ("KVM: arm64:
Allocate stage-2 pgd pages with GFP_KERNEL_ACCOUNT") and c419621873713 ("KVM: s390: Add memcg accounting to KVM allocations"), so this is not just a theoretical issue.
--- mm/page_alloc.c | 1 + 1 file changed, 1 insertion(+)
mm/page_alloc.c +1 -0
@@ -3313,6 +3313,7 @@ void split_page(struct page *page, unsigfor (i =1 ; i < (1 << order); i++)set_page_refcounted (page + i);split_page_owner (page,1 << order); +split_page_memcg (page,1 << order); }EXPORT_SYMBOL_GPL (split_page);
[email protected]
maintainerPATCH 304/306 mm/memcg: rename mem_cgroup_split_huge_fixup to split_page_memcg and add nr_pages argument
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Zhou Guanghui <[email protected]>
commit be6c8982e4ab9a41907555f601b711a7e2a17d4c upstream.
Rename mem_cgroup_split_huge_fixup to split_page_memcg and explicitly pass in page number argument.
In this way, the interface name is more common and can be used by potential users. In addition, the complete info(memcg and flag) of the memcg needs to be set to the tail pages.
--- include/linux/memcontrol.h | 6 ++---- mm/huge_memory.c | 2 +- mm/memcontrol.c | 15 ++++++--------- 3 files changed, 9 insertions(+), 14 deletions(-)
include/linux/memcontrol.h +2 -4
@@ -1072,9 +1072,7 @@ static inline void memcg_memory_event_mm rcu_read_unlock(); } -#ifdef CONFIG_TRANSPARENT_HUGEPAGE -void mem_cgroup_split_huge_fixup (struct page *head); -#endif +void split_page_memcg (struct page *head,unsigned int nr);#else /* CONFIG_MEMCG */
@@ -1416,7 +1414,7 @@ unsigned long mem_cgroup_soft_limit_reclreturn 0 ; } -static inline void mem_cgroup_split_huge_fixup (struct page *head) +static inline void split_page_memcg (struct page *head,unsigned int nr) { }
mm/huge_memory.c +1 -1
@@ -2465,7 +2465,7 @@ static void __split_huge_page(struct pagint i;/* complete memcg works before add pages to LRU */ -mem_cgroup_split_huge_fixup (head); +split_page_memcg (head, nr);if (PageAnon (head) &&PageSwapCache (head)) {swp_entry_t entry = { .val =page_private (head) };
mm/memcontrol.c +6 -9
@@ -3296,24 +3296,21 @@ void obj_cgroup_uncharge(struct obj_cgro#endif /* CONFIG_MEMCG_KMEM */ -#ifdef CONFIG_TRANSPARENT_HUGEPAGE /* -* Because page_memcg(head) is not set on compound tails, set it now. +* Because page_memcg(head) is not set on tails, set it now. */ -void mem_cgroup_split_huge_fixup (struct page *head) +void split_page_memcg (struct page *head,unsigned int nr) {struct mem_cgroup *memcg =page_memcg (head);int i; -if (mem_cgroup_disabled ()) +if (mem_cgroup_disabled () || !memcg)return ; -for (i =1 ; i <HPAGE_PMD_NR ; i++) { -css_get (&memcg->css); - head[i].memcg_data = (unsigned long )memcg; - } +for (i =1 ; i < nr; i++) + head[i].memcg_data = head->memcg_data; +css_get_many (&memcg->css, nr -1 ); } -#endif /* CONFIG_TRANSPARENT_HUGEPAGE */ #ifdef CONFIG_MEMCG_SWAP /**
[email protected]
maintainerPATCH 305/306 mm/page_alloc.c: refactor initialization of struct page for holes in memory layout
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Mike Rapoport <[email protected]>
commit 0740a50b9baa4472cfb12442df4b39e2712a64a4 upstream.
There could be struct pages that are not backed by actual physical memory. This can happen when the actual memory bank is not a multiple of SECTION_SIZE or when an architecture does not register memory holes reserved by the firmware as memblock.memory.
Such pages are currently initialized using init_unavailable_mem() function that iterates through PFNs in holes in memblock.memory and if there is a struct page corresponding to a PFN, the fields of this page are set to default values and it is marked as Reserved.
init_unavailable_mem() does not take into account zone and node the page belongs to and sets both zone and node links in struct page to zero.
Before commit 73a6e474cb37 ("mm: memmap_init: iterate over memblock regions rather that check each PFN") the holes inside a zone were re-initialized during memmap_init() and got their zone/node links right. However, after that commit nothing updates the struct pages representing such holes.
On a system that has firmware reserved holes in a zone above ZONE_DMA, for instance in a configuration below:
# grep -A1 E820 /proc/iomem 7a17b000-7a216fff : Unknown E820 type 7a217000-7bffffff : System RAM
unset zone link in struct page will trigger
VM_BUG_ON_PAGE(!zone_spans_pfn(page_zone(page), pfn), page);
in set_pfnblock_flags_mask() when called with a struct page from a range other than E820_TYPE_RAM because there are pages in the range of ZONE_DMA32 but the unset zone link in struct page makes them appear as a part of ZONE_DMA.
Interleave initialization of the unavailable pages with the normal initialization of memory map, so that zone and node information will be properly set on struct pages that are not backed by the actual memory.
With this change the pages for holes inside a zone will get proper zone/node links and the pages that are not spanned by any node will get links to the adjacent zone/node. The holes between nodes will be prepended to the zone/node above the hole and the trailing pages in the last section that will be appended to the zone/node below.
[[email protected]: don't initialize static to zero, use %llu for u64]
--- mm/page_alloc.c | 158 ++++++++++++++++++++++++++------------------------------ 1 file changed, 75 insertions(+), 83 deletions(-)
mm/page_alloc.c +75 -83
@@ -6262,13 +6262,66 @@ static void __meminit zone_init_free_lis } } +#if !defined(CONFIG_FLAT_NODE_MEM_MAP ) +/* +* Only struct pages that correspond to ranges defined by memblock.memory +* are zeroed and initialized by going through __init_single_page() during +* memmap_init_zone(). +* +* But, there could be struct pages that correspond to holes in +* memblock.memory. This can happen because of the following reasons: +* - physical memory bank size is not necessarily the exact multiple of the +* arbitrary section size +* - early reserved memory may not be listed in memblock.memory +* - memory layouts defined with memmap= kernel parameter may not align +* nicely with memmap sections +* +* Explicitly initialize those struct pages so that: +* - PG_Reserved is set +* - zone and node links point to zone and node that span the page if the +* hole is in the middle of a zone +* - zone and node links point to adjacent zone/node if the hole falls on +* the zone boundary; the pages in such holes will be prepended to the +* zone/node above the hole except for the trailing pages in the last +* section that will be appended to the zone/node below. +*/ +static u64 __meminit init_unavailable_range (unsigned long spfn, +unsigned long epfn, +int zone,int node) +{ +unsigned long pfn; +u64 pgcnt =0 ; + +for (pfn = spfn; pfn < epfn; pfn++) { +if (!pfn_valid (ALIGN_DOWN (pfn, pageblock_nr_pages))) { + pfn =ALIGN_DOWN (pfn, pageblock_nr_pages) + + pageblock_nr_pages -1 ; +continue ; + } +__init_single_page (pfn_to_page (pfn), pfn, zone, node); +__SetPageReserved (pfn_to_page (pfn)); + pgcnt++; + } + +return pgcnt; +} +#else +static inline u64 init_unavailable_range (unsigned long spfn,unsigned long epfn, +int zone,int node) +{ +return 0 ; +} +#endif +void __meminit __weak memmap_init (unsigned long size,int nid,unsigned long zone,unsigned long range_start_pfn) { +static unsigned long hole_pfn;unsigned long start_pfn, end_pfn;unsigned long range_end_pfn = range_start_pfn + size;int i; +u64 pgcnt =0 ;for_each_mem_pfn_range (i, nid, &start_pfn, &end_pfn,NULL ) { start_pfn =clamp (start_pfn, range_start_pfn, range_end_pfn);
@@ -6279,7 +6332,29 @@ void __meminit __weak memmap_init(unsignmemmap_init_zone (size, nid, zone, start_pfn, range_end_pfn,MEMINIT_EARLY ,NULL ,MIGRATE_MOVABLE ); } + +if (hole_pfn < start_pfn) + pgcnt +=init_unavailable_range (hole_pfn, start_pfn, + zone, nid); + hole_pfn = end_pfn; } + +#ifdef CONFIG_SPARSEMEM +/* +* Initialize the hole in the range [zone_end_pfn, section_end]. +* If zone boundary falls in the middle of a section, this hole +* will be re-initialized during the call to this function for the +* higher zone. +*/ + end_pfn =round_up (range_end_pfn,PAGES_PER_SECTION ); +if (hole_pfn < end_pfn) + pgcnt +=init_unavailable_range (hole_pfn, end_pfn, + zone, nid); +#endif + +if (pgcnt) +pr_info (" %s zone: %llu pages in unavailable ranges\n" , + zone_names[zone], pgcnt); }static int zone_batchsize (struct zone *zone)
@@ -7080,88 +7155,6 @@ void __init free_area_init_memoryless_nofree_area_init_node (nid); } -#if !defined(CONFIG_FLAT_NODE_MEM_MAP ) -/* -* Initialize all valid struct pages in the range [spfn, epfn) and mark them -* PageReserved(). Return the number of struct pages that were initialized. -*/ -static u64 __init init_unavailable_range (unsigned long spfn,unsigned long epfn) -{ -unsigned long pfn; -u64 pgcnt =0 ; - -for (pfn = spfn; pfn < epfn; pfn++) { -if (!pfn_valid (ALIGN_DOWN (pfn, pageblock_nr_pages))) { - pfn =ALIGN_DOWN (pfn, pageblock_nr_pages) - + pageblock_nr_pages -1 ; -continue ; - } -/* -* Use a fake node/zone (0) for now. Some of these pages -* (in memblock.reserved but not in memblock.memory) will -* get re-initialized via reserve_bootmem_region() later. -*/ -__init_single_page (pfn_to_page (pfn), pfn,0 ,0 ); -__SetPageReserved (pfn_to_page (pfn)); - pgcnt++; - } - -return pgcnt; -} - -/* -* Only struct pages that are backed by physical memory are zeroed and -* initialized by going through __init_single_page(). But, there are some -* struct pages which are reserved in memblock allocator and their fields -* may be accessed (for example page_to_pfn() on some configuration accesses -* flags). We must explicitly initialize those struct pages. -* -* This function also addresses a similar issue where struct pages are left -* uninitialized because the physical address range is not covered by -* memblock.memory or memblock.reserved. That could happen when memblock -* layout is manually configured via memmap=, or when the highest physical -* address (max_pfn) does not end on a section boundary. -*/ -static void __init init_unavailable_mem (void ) -{ -phys_addr_t start, end; -u64 i, pgcnt; -phys_addr_t next =0 ; - -/* -* Loop through unavailable ranges not covered by memblock.memory. -*/ - pgcnt =0 ; -for_each_mem_range (i, &start, &end) { -if (next < start) - pgcnt +=init_unavailable_range (PFN_DOWN (next), -PFN_UP (start)); - next = end; - } - -/* -* Early sections always have a fully populated memmap for the whole -* section - see pfn_valid(). If the last section has holes at the -* end and that section is marked "online", the memmap will be -* considered initialized. Make sure that memmap has a well defined -* state. -*/ - pgcnt +=init_unavailable_range (PFN_DOWN (next), -round_up (max_pfn,PAGES_PER_SECTION )); - -/* -* Struct pages that do not have backing memory. This could be because -* firmware is using some of this memory, or for some other reasons. -*/ -if (pgcnt) -pr_info ("Zeroed struct page in unavailable ranges: %lld pages" , pgcnt); -} -#else -static inline void __init init_unavailable_mem (void ) -{ -} -#endif /* !CONFIG_FLAT_NODE_MEM_MAP */ -#if MAX_NUMNODES >1 /* * Figure out the number of possible node ids.
@@ -7585,7 +7578,6 @@ void __init free_area_init(unsigned long/* Initialise every node */ mminit_verify_pageflags_layout ();setup_nr_node_ids (); -init_unavailable_mem ();for_each_online_node (nid) {pg_data_t *pgdat =NODE_DATA (nid);free_area_init_node (nid);
Quoted 11 lines · On Mon, 15 Mar 2021 14:51:03 +0100, [email protected] wrote:
From: Greg Kroah-Hartman <[email protected]>
This is the start of the stable review cycle for the 5.11.7 release. There are 306 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed, 17 Mar 2021 13:54:26 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.11.7-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.11.y
and the diffstat can be found below.thanks,
greg k-h
All tests passing for Tegra ...
Test results for stable-v5.11:
12 builds: 12 pass, 0 fail
28 boots: 28 pass, 0 fail
65 tests: 65 pass, 0 failLinux version: 5.11.7-rc1-gb87703cf6c9b
Boards tested: tegra124-jetson-tk1, tegra186-p2771-0000,
tegra194-p2972-0000, tegra194-p3509-0000+p3668-0000,
tegra20-ventana, tegra210-p2371-2180,
tegra210-p3450-0000, tegra30-cardhu-a04Jon
Quoted 3 lines · On Mon, 15 Mar 2021 14:51:03 +0100 [email protected] wrote:
From: Greg Kroah-Hartman <[email protected]>
This is the start of the stable review cycle for the 5.11.7 release.
Tested on amd64, arm64, armhf, i386, m68k, or1k, powerpc, ppc64, ppc64el, riscv64, s390x, sparc64. No problems detected.
Quoted 12 lines · On Mon, 15 Mar 2021 at 19:27, <[email protected]> wrote:
From: Greg Kroah-Hartman <[email protected]>
This is the start of the stable review cycle for the 5.11.7 release. There are 306 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed, 17 Mar 2021 13:54:26 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.11.7-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.11.y
and the diffstat can be found below.thanks,
greg k-h
Results from Linaro’s test farm.
No regressions on arm64, arm, x86_64, and i386.
Summary
------------------------------------------------------------------------
kernel: 5.11.7-rc1
git repo: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
git branch: linux-5.11.y
git commit: f109baa2424b2523fbb975de996fedc7a53ef531
git describe: v5.11.6-307-gf109baa2424b
Test details: https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-5.11.y/build/v5.11.6-307-gf109baa2424b
No regressions (compared to build v5.11.6)
No fixes (compared to build v5.11.6)
Ran 55999 total tests in the following environments and test suites.
Environments
--------------
- arc
- arm
- arm64
- dragonboard-410c
- hi6220-hikey
- i386
- juno-64k_page_size
- juno-r2
- juno-r2-compat
- juno-r2-kasan
- mips
- nxp-ls2088
- nxp-ls2088-64k_page_size
- parisc
- powerpc
- qemu-arm-clang
- qemu-arm64-clang
- qemu-arm64-kasan
- qemu-i386-clang
- qemu-x86_64-clang
- qemu-x86_64-kasan
- qemu-x86_64-kcsan
- qemu_arm
- qemu_arm64
- qemu_arm64-compat
- qemu_i386
- qemu_x86_64
- qemu_x86_64-compat
- riscv
- s390
- sh
- sparc
- x15
- x86
- x86-kasan
- x86_64
Test Suites
-----------
* build
* linux-log-parser
* install-android-platform-tools-r2600
* kselftest-
* kselftest-efivarfs
* kselftest-filesystems
* kselftest-firmware
* kselftest-fpu
* kselftest-futex
* kselftest-gpio
* kselftest-ipc
* kselftest-ir
* kselftest-kcmp
* kselftest-lib
* kselftest-lkdtm
* kselftest-membarrier
* kselftest-memfd
* kselftest-memory-hotplug
* kselftest-mincore
* kselftest-mount
* kselftest-mqueue
* kselftest-net
* kselftest-netfilter
* kselftest-nsfs
* kselftest-openat2
* kselftest-pid_namespace
* kselftest-pidfd
* kselftest-proc
* kselftest-pstore
* kselftest-rseq
* kselftest-rtc
* kselftest-seccomp
* kselftest-sigaltstack
* kselftest-size
* kselftest-splice
* kselftest-static_keys
* kselftest-sync
* kselftest-sysctl
* kselftest-tc-testing
* ltp-cap_bounds-tests
* ltp-containers-tests
* ltp-cpuhotplug-tests
* ltp-crypto-tests
* ltp-dio-tests
* ltp-fs-tests
* ltp-io-tests
* ltp-ipc-tests
* ltp-syscalls-tests
* perf
* v4l2-compliance
* fwts
* kselftest-android
* kselftest-bpf
* kselftest-capabilities
* kselftest-cgroup
* kselftest-clone3
* kselftest-core
* kselftest-cpu-hotplug
* kselftest-cpufreq
* kselftest-timens
* kselftest-timers
* kselftest-tmpfs
* kselftest-tpm2
* kselftest-user
* kselftest-zram
* ltp-commands-tests
* ltp-cve-tests
* ltp-fcntl-locktests-tests
* ltp-filecaps-tests
* ltp-fs_bind-tests
* ltp-fs_perms_simple-tests
* ltp-fsx-tests
* ltp-hugetlb-tests
* ltp-math-tests
* ltp-nptl-tests
* ltp-pty-tests
* ltp-sched-tests
* ltp-securebits-tests
* ltp-tracing-tests
* network-basic-tests
* kselftest-intel_pstate
* kselftest-kexec
* kselftest-kvm
* kselftest-livepatch
* kselftest-ptrace
* kselftest-vm
* kselftest-x86
* libhugetlbfs
* ltp-controllers-tests
* ltp-mm-tests
* ltp-open-posix-tests
* kvm-unit-tests
* rcutorture
* kunit
* kselftest-vsyscall-mode-native-
* kselftest-vsyscall-mode-none-
* ssuite
Signature · 2 lines
Linaro LKFT https://lkft.linaro.org
Quoted 10 lines · On Mon, Mar 15, 2021 at 02:51:03PM +0100, [email protected] wrote:
From: Greg Kroah-Hartman <[email protected]>
This is the start of the stable review cycle for the 5.11.7 release. There are 306 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed, 17 Mar 2021 13:54:26 +0000. Anything received after that time might be too late.
Build results:
total: 155 pass: 155 fail: 0 Qemu test results: total: 436 pass: 436 fail: 0
Guenter
Quoted 7 lines · On Mon, Mar 15, 2021 at 02:51:03PM +0100, [email protected] wrote:
From: Greg Kroah-Hartman <[email protected]>
This is the start of the stable review cycle for the 5.11.7 release. There are 306 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Compiled and booted with no regressions on x86_64.
thanks,
Ross
Greg KH
maintainerQuoted 12 lines · Guenter Roeck
Quoted 10 lines · On Mon, Mar 15, 2021 at 02:51:03PM +0100, [email protected] wrote:
From: Greg Kroah-Hartman <[email protected]>
This is the start of the stable review cycle for the 5.11.7 release. There are 306 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed, 17 Mar 2021 13:54:26 +0000. Anything received after that time might be too late.
Quoted 6 lines
Build results:
total: 155 pass: 155 fail: 0 Qemu test results: total: 436 pass: 436 fail: 0Tested-by Guenter Roeck <[email protected]>
Thanks for testing them all and letting me know.
greg k-h
Greg Kroah-Hartman
maintainerQuoted 20 lines · Naresh Kamboju
Quoted 19 lines · On Mon, 15 Mar 2021 at 19:27, <[email protected]> wrote:
From: Greg Kroah-Hartman <[email protected]>
This is the start of the stable review cycle for the 5.11.7 release. There are 306 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed, 17 Mar 2021 13:54:26 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.11.7-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.11.y
and the diffstat can be found below.thanks,
Quoted 7 lines
Quoted 1 line
greg k-h
Results from Linaro’s test farm.
No regressions on arm64, arm,x86_64, and i386.
Thanks for testing them all and letting me know.
greg k-h