linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/8] Cleanup and optimization patches for percpu
@ 2022-10-24  8:14 Baoquan He
  2022-10-24  8:14 ` [PATCH 1/8] mm/percpu: remove unused pcpu_map_extend_chunks Baoquan He
                   ` (9 more replies)
  0 siblings, 10 replies; 29+ messages in thread
From: Baoquan He @ 2022-10-24  8:14 UTC (permalink / raw)
  To: linux-kernel
  Cc: Dennis Zhou, Tejun Heo, Christoph Lameter, Andrew Morton,
	linux-mm, Baoquan He

These were found out when reading percpu code, and queued in my local
branch for long time. Send them out for reviewing.

Baoquan He (8):
  mm/percpu: remove unused pcpu_map_extend_chunks
  mm/percpu: use list_first_entry_or_null in pcpu_reclaim_populated()
  mm/percpu: Update the code comment when creating new chunk
  mm/percpu: add comment to state the empty populated pages accounting
  mm/percpu: replace the goto with break
  mm/percpu.c: remove the lcm code since block size is fixed at page
    size
  mm/percpu: remove unused PERCPU_DYNAMIC_EARLY_SLOTS
  mm/slub, percpu: correct the calculation of early percpu allocation
    size

 include/linux/percpu.h |  7 +++----
 mm/percpu.c            | 44 +++++++++++++++++-------------------------
 mm/slub.c              |  3 ++-
 3 files changed, 23 insertions(+), 31 deletions(-)

-- 
2.34.1



^ permalink raw reply	[flat|nested] 29+ messages in thread

* [PATCH 1/8] mm/percpu: remove unused pcpu_map_extend_chunks
  2022-10-24  8:14 [PATCH 0/8] Cleanup and optimization patches for percpu Baoquan He
@ 2022-10-24  8:14 ` Baoquan He
  2022-10-24 16:51   ` Dennis Zhou
  2022-10-24  8:14 ` [PATCH 2/8] mm/percpu: use list_first_entry_or_null in pcpu_reclaim_populated() Baoquan He
                   ` (8 subsequent siblings)
  9 siblings, 1 reply; 29+ messages in thread
From: Baoquan He @ 2022-10-24  8:14 UTC (permalink / raw)
  To: linux-kernel
  Cc: Dennis Zhou, Tejun Heo, Christoph Lameter, Andrew Morton,
	linux-mm, Baoquan He

Since commit 40064aeca35c ("percpu: replace area map allocator with
bitmap"), it is unneeded.

Signed-off-by: Baoquan He <bhe@redhat.com>
---
 mm/percpu.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/mm/percpu.c b/mm/percpu.c
index 27697b2429c2..26d8cd2ca323 100644
--- a/mm/percpu.c
+++ b/mm/percpu.c
@@ -174,9 +174,6 @@ static DEFINE_MUTEX(pcpu_alloc_mutex);	/* chunk create/destroy, [de]pop, map ext
 
 struct list_head *pcpu_chunk_lists __ro_after_init; /* chunk list slots */
 
-/* chunks which need their map areas extended, protected by pcpu_lock */
-static LIST_HEAD(pcpu_map_extend_chunks);
-
 /*
  * The number of empty populated pages, protected by pcpu_lock.
  * The reserved chunk doesn't contribute to the count.
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [PATCH 2/8] mm/percpu: use list_first_entry_or_null in pcpu_reclaim_populated()
  2022-10-24  8:14 [PATCH 0/8] Cleanup and optimization patches for percpu Baoquan He
  2022-10-24  8:14 ` [PATCH 1/8] mm/percpu: remove unused pcpu_map_extend_chunks Baoquan He
@ 2022-10-24  8:14 ` Baoquan He
  2022-10-24 10:17   ` kernel test robot
                     ` (2 more replies)
  2022-10-24  8:14 ` [PATCH 3/8] mm/percpu: Update the code comment when creating new chunk Baoquan He
                   ` (7 subsequent siblings)
  9 siblings, 3 replies; 29+ messages in thread
From: Baoquan He @ 2022-10-24  8:14 UTC (permalink / raw)
  To: linux-kernel
  Cc: Dennis Zhou, Tejun Heo, Christoph Lameter, Andrew Morton,
	linux-mm, Baoquan He

To replace list_empty()/list_first_entry() pair to simplify code.

Signed-off-by: Baoquan He <bhe@redhat.com>
---
 mm/percpu.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/mm/percpu.c b/mm/percpu.c
index 26d8cd2ca323..a3fde4ac03a4 100644
--- a/mm/percpu.c
+++ b/mm/percpu.c
@@ -2143,9 +2143,9 @@ static void pcpu_reclaim_populated(void)
 	 * other accessor is the free path which only returns area back to the
 	 * allocator not touching the populated bitmap.
 	 */
-	while (!list_empty(&pcpu_chunk_lists[pcpu_to_depopulate_slot])) {
-		chunk = list_first_entry(&pcpu_chunk_lists[pcpu_to_depopulate_slot],
-					 struct pcpu_chunk, list);
+	while (chunk = list_first_entry_or_null(
+			&pcpu_chunk_lists[pcpu_to_depopulate_slot],
+			struct pcpu_chunk, list)) {
 		WARN_ON(chunk->immutable);
 
 		/*
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [PATCH 3/8] mm/percpu: Update the code comment when creating new chunk
  2022-10-24  8:14 [PATCH 0/8] Cleanup and optimization patches for percpu Baoquan He
  2022-10-24  8:14 ` [PATCH 1/8] mm/percpu: remove unused pcpu_map_extend_chunks Baoquan He
  2022-10-24  8:14 ` [PATCH 2/8] mm/percpu: use list_first_entry_or_null in pcpu_reclaim_populated() Baoquan He
@ 2022-10-24  8:14 ` Baoquan He
  2022-10-24 16:54   ` Dennis Zhou
  2022-10-24  8:14 ` [PATCH 4/8] mm/percpu: add comment to state the empty populated pages accounting Baoquan He
                   ` (6 subsequent siblings)
  9 siblings, 1 reply; 29+ messages in thread
From: Baoquan He @ 2022-10-24  8:14 UTC (permalink / raw)
  To: linux-kernel
  Cc: Dennis Zhou, Tejun Heo, Christoph Lameter, Andrew Morton,
	linux-mm, Baoquan He

The lock pcpu_alloc_mutex taking code has been moved to the beginning of
pcpu_allo() if it's non atomic allocation. So the code comment above
above pcpu_create_chunk() callsite need be updated.

Signed-off-by: Baoquan He <bhe@redhat.com>
---
 mm/percpu.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/mm/percpu.c b/mm/percpu.c
index a3fde4ac03a4..a8121302a79c 100644
--- a/mm/percpu.c
+++ b/mm/percpu.c
@@ -1817,16 +1817,12 @@ static void __percpu *pcpu_alloc(size_t size, size_t align, bool reserved,
 
 	spin_unlock_irqrestore(&pcpu_lock, flags);
 
-	/*
-	 * No space left.  Create a new chunk.  We don't want multiple
-	 * tasks to create chunks simultaneously.  Serialize and create iff
-	 * there's still no empty chunk after grabbing the mutex.
-	 */
 	if (is_atomic) {
 		err = "atomic alloc failed, no space left";
 		goto fail;
 	}
 
+	/* No space left.  Create a new chunk. */
 	if (list_empty(&pcpu_chunk_lists[pcpu_free_slot])) {
 		chunk = pcpu_create_chunk(pcpu_gfp);
 		if (!chunk) {
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [PATCH 4/8] mm/percpu: add comment to state the empty populated pages accounting
  2022-10-24  8:14 [PATCH 0/8] Cleanup and optimization patches for percpu Baoquan He
                   ` (2 preceding siblings ...)
  2022-10-24  8:14 ` [PATCH 3/8] mm/percpu: Update the code comment when creating new chunk Baoquan He
@ 2022-10-24  8:14 ` Baoquan He
  2022-10-24 16:56   ` Dennis Zhou
  2022-10-25  3:45   ` [PATCH v2 " Baoquan He
  2022-10-24  8:14 ` [PATCH 5/8] mm/percpu: replace the goto with break Baoquan He
                   ` (5 subsequent siblings)
  9 siblings, 2 replies; 29+ messages in thread
From: Baoquan He @ 2022-10-24  8:14 UTC (permalink / raw)
  To: linux-kernel
  Cc: Dennis Zhou, Tejun Heo, Christoph Lameter, Andrew Morton,
	linux-mm, Baoquan He

When allocating an area from a chunk, pcpu_block_update_hint_alloc()
is called to update chunk metadata, including chunk's and global
nr_empty_pop_pages. However, if the allocation is not atomic, some
blocks may not be populated with pages yet, while we still account it
here. The number of pages will be subtracted with pcpu_chunk_populated()
when populating pages.

Adding code comment to make that more understandable.

Signed-off-by: Baoquan He <bhe@redhat.com>
---
 mm/percpu.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/mm/percpu.c b/mm/percpu.c
index a8121302a79c..09e407338573 100644
--- a/mm/percpu.c
+++ b/mm/percpu.c
@@ -831,13 +831,15 @@ static void pcpu_block_update_hint_alloc(struct pcpu_chunk *chunk, int bit_off,
 
 	/*
 	 * Update s_block.
-	 * block->first_free must be updated if the allocation takes its place.
-	 * If the allocation breaks the contig_hint, a scan is required to
-	 * restore this hint.
 	 */
 	if (s_block->contig_hint == PCPU_BITMAP_BLOCK_BITS)
 		nr_empty_pages++;
 
+	/*
+	 * block->first_free must be updated if the allocation takes its place.
+	 * If the allocation breaks the contig_hint, a scan is required to
+	 * restore this hint.
+	 */
 	if (s_off == s_block->first_free)
 		s_block->first_free = find_next_zero_bit(
 					pcpu_index_alloc_map(chunk, s_index),
@@ -912,6 +914,12 @@ static void pcpu_block_update_hint_alloc(struct pcpu_chunk *chunk, int bit_off,
 		}
 	}
 
+	/*
+	 * If the allocation is not atomic, some blocks may not
+	 * be populated with pages, while we account it here.
+	 * The number of pages will be subtracted with
+	 * pcpu_chunk_populated() when populating pages.
+	 */
 	if (nr_empty_pages)
 		pcpu_update_empty_pages(chunk, -nr_empty_pages);
 
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [PATCH 5/8] mm/percpu: replace the goto with break
  2022-10-24  8:14 [PATCH 0/8] Cleanup and optimization patches for percpu Baoquan He
                   ` (3 preceding siblings ...)
  2022-10-24  8:14 ` [PATCH 4/8] mm/percpu: add comment to state the empty populated pages accounting Baoquan He
@ 2022-10-24  8:14 ` Baoquan He
  2022-10-24 17:00   ` Dennis Zhou
  2022-10-24  8:14 ` [PATCH 6/8] mm/percpu.c: remove the lcm code since block size is fixed at page size Baoquan He
                   ` (4 subsequent siblings)
  9 siblings, 1 reply; 29+ messages in thread
From: Baoquan He @ 2022-10-24  8:14 UTC (permalink / raw)
  To: linux-kernel
  Cc: Dennis Zhou, Tejun Heo, Christoph Lameter, Andrew Morton,
	linux-mm, Baoquan He

In function pcpu_reclaim_populated(), the line of goto jumping is
unnecessary since the label 'end_chunk' is near the end of the for
loop, use break instead.

Signed-off-by: Baoquan He <bhe@redhat.com>
---
 mm/percpu.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/mm/percpu.c b/mm/percpu.c
index 09e407338573..954abf916c7d 100644
--- a/mm/percpu.c
+++ b/mm/percpu.c
@@ -2167,7 +2167,7 @@ static void pcpu_reclaim_populated(void)
 			/* reintegrate chunk to prevent atomic alloc failures */
 			if (pcpu_nr_empty_pop_pages < PCPU_EMPTY_POP_PAGES_HIGH) {
 				reintegrate = true;
-				goto end_chunk;
+				break;
 			}
 
 			/*
@@ -2203,7 +2203,6 @@ static void pcpu_reclaim_populated(void)
 			end = -1;
 		}
 
-end_chunk:
 		/* batch tlb flush per chunk to amortize cost */
 		if (freed_page_start < freed_page_end) {
 			spin_unlock_irq(&pcpu_lock);
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [PATCH 6/8] mm/percpu.c: remove the lcm code since block size is fixed at page size
  2022-10-24  8:14 [PATCH 0/8] Cleanup and optimization patches for percpu Baoquan He
                   ` (4 preceding siblings ...)
  2022-10-24  8:14 ` [PATCH 5/8] mm/percpu: replace the goto with break Baoquan He
@ 2022-10-24  8:14 ` Baoquan He
  2022-10-24 17:00   ` Dennis Zhou
  2022-10-24  8:14 ` [PATCH 7/8] mm/percpu: remove unused PERCPU_DYNAMIC_EARLY_SLOTS Baoquan He
                   ` (3 subsequent siblings)
  9 siblings, 1 reply; 29+ messages in thread
From: Baoquan He @ 2022-10-24  8:14 UTC (permalink / raw)
  To: linux-kernel
  Cc: Dennis Zhou, Tejun Heo, Christoph Lameter, Andrew Morton,
	linux-mm, Baoquan He

Since commit b239f7daf553 ("percpu: set PCPU_BITMAP_BLOCK_SIZE to
PAGE_SIZE"), the PCPU_BITMAP_BLOCK_SIZE has been set to page size
fixedly. So the lcm code in pcpu_alloc_first_chunk() doesn't make
sense any more, clean it up.

Signed-off-by: Baoquan He <bhe@redhat.com>
---
 mm/percpu.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/mm/percpu.c b/mm/percpu.c
index 954abf916c7d..96191f7b61ba 100644
--- a/mm/percpu.c
+++ b/mm/percpu.c
@@ -72,7 +72,6 @@
 #include <linux/cpumask.h>
 #include <linux/memblock.h>
 #include <linux/err.h>
-#include <linux/lcm.h>
 #include <linux/list.h>
 #include <linux/log2.h>
 #include <linux/mm.h>
@@ -1347,7 +1346,7 @@ static struct pcpu_chunk * __init pcpu_alloc_first_chunk(unsigned long tmp_addr,
 							 int map_size)
 {
 	struct pcpu_chunk *chunk;
-	unsigned long aligned_addr, lcm_align;
+	unsigned long aligned_addr;
 	int start_offset, offset_bits, region_size, region_bits;
 	size_t alloc_size;
 
@@ -1355,14 +1354,7 @@ static struct pcpu_chunk * __init pcpu_alloc_first_chunk(unsigned long tmp_addr,
 	aligned_addr = tmp_addr & PAGE_MASK;
 
 	start_offset = tmp_addr - aligned_addr;
-
-	/*
-	 * Align the end of the region with the LCM of PAGE_SIZE and
-	 * PCPU_BITMAP_BLOCK_SIZE.  One of these constants is a multiple of
-	 * the other.
-	 */
-	lcm_align = lcm(PAGE_SIZE, PCPU_BITMAP_BLOCK_SIZE);
-	region_size = ALIGN(start_offset + map_size, lcm_align);
+	region_size = ALIGN(start_offset + map_size, PAGE_SIZE);
 
 	/* allocate chunk */
 	alloc_size = struct_size(chunk, populated,
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [PATCH 7/8] mm/percpu: remove unused PERCPU_DYNAMIC_EARLY_SLOTS
  2022-10-24  8:14 [PATCH 0/8] Cleanup and optimization patches for percpu Baoquan He
                   ` (5 preceding siblings ...)
  2022-10-24  8:14 ` [PATCH 6/8] mm/percpu.c: remove the lcm code since block size is fixed at page size Baoquan He
@ 2022-10-24  8:14 ` Baoquan He
  2022-10-24 17:03   ` Dennis Zhou
  2022-10-24  8:14 ` [PATCH 8/8] mm/slub, percpu: correct the calculation of early percpu allocation size Baoquan He
                   ` (2 subsequent siblings)
  9 siblings, 1 reply; 29+ messages in thread
From: Baoquan He @ 2022-10-24  8:14 UTC (permalink / raw)
  To: linux-kernel
  Cc: Dennis Zhou, Tejun Heo, Christoph Lameter, Andrew Morton,
	linux-mm, Baoquan He

Since commit 40064aeca35c ("percpu: replace area map allocator with
bitmap"), there's no place to use PERCPU_DYNAMIC_EARLY_SLOTS. So
clean it up.

Signed-off-by: Baoquan He <bhe@redhat.com>
---
 include/linux/percpu.h | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/include/linux/percpu.h b/include/linux/percpu.h
index f1ec5ad1351c..70bc17db00a6 100644
--- a/include/linux/percpu.h
+++ b/include/linux/percpu.h
@@ -37,11 +37,10 @@
 /*
  * Percpu allocator can serve percpu allocations before slab is
  * initialized which allows slab to depend on the percpu allocator.
- * The following two parameters decide how much resource to
- * preallocate for this.  Keep PERCPU_DYNAMIC_RESERVE equal to or
- * larger than PERCPU_DYNAMIC_EARLY_SIZE.
+ * The following parameter decide how much resource to preallocate
+ * for this.  Keep PERCPU_DYNAMIC_RESERVE equal to or larger than
+ * PERCPU_DYNAMIC_EARLY_SIZE.
  */
-#define PERCPU_DYNAMIC_EARLY_SLOTS	128
 #define PERCPU_DYNAMIC_EARLY_SIZE	(12 << 10)
 
 /*
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [PATCH 8/8] mm/slub, percpu: correct the calculation of early percpu allocation size
  2022-10-24  8:14 [PATCH 0/8] Cleanup and optimization patches for percpu Baoquan He
                   ` (6 preceding siblings ...)
  2022-10-24  8:14 ` [PATCH 7/8] mm/percpu: remove unused PERCPU_DYNAMIC_EARLY_SLOTS Baoquan He
@ 2022-10-24  8:14 ` Baoquan He
  2022-10-24 13:52   ` Hyeonggon Yoo
                     ` (2 more replies)
  2022-10-24 17:09 ` [PATCH 0/8] Cleanup and optimization patches for percpu Dennis Zhou
  2022-11-08  7:05 ` Dennis Zhou
  9 siblings, 3 replies; 29+ messages in thread
From: Baoquan He @ 2022-10-24  8:14 UTC (permalink / raw)
  To: linux-kernel
  Cc: Dennis Zhou, Tejun Heo, Christoph Lameter, Andrew Morton,
	linux-mm, Baoquan He, Pekka Enberg, David Rientjes, Joonsoo Kim,
	Vlastimil Babka, Roman Gushchin, Hyeonggon Yoo

SLUB allocator relies on percpu allocator to initialize its ->cpu_slab
during early boot. For that, the dynamic chunk of percpu which serves
the early allocation need be large enough to satisfy the kmalloc
creation.

However, the current BUILD_BUG_ON() in alloc_kmem_cache_cpus() doesn't
consider the kmalloc array with NR_KMALLOC_TYPES length. Fix that
with correct calculation.

Signed-off-by: Baoquan He <bhe@redhat.com>
Cc: Christoph Lameter <cl@linux.com>
Cc: Pekka Enberg <penberg@kernel.org>
Cc: David Rientjes <rientjes@google.com>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Roman Gushchin <roman.gushchin@linux.dev>
Cc: Hyeonggon Yoo <42.hyeyoo@gmail.com>
---
 mm/slub.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/mm/slub.c b/mm/slub.c
index 157527d7101b..8ac3bb9a122a 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -4017,7 +4017,8 @@ init_kmem_cache_node(struct kmem_cache_node *n)
 static inline int alloc_kmem_cache_cpus(struct kmem_cache *s)
 {
 	BUILD_BUG_ON(PERCPU_DYNAMIC_EARLY_SIZE <
-			KMALLOC_SHIFT_HIGH * sizeof(struct kmem_cache_cpu));
+			NR_KMALLOC_TYPES * KMALLOC_SHIFT_HIGH *
+			sizeof(struct kmem_cache_cpu));
 
 	/*
 	 * Must align to double word boundary for the double cmpxchg
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 29+ messages in thread

* Re: [PATCH 2/8] mm/percpu: use list_first_entry_or_null in pcpu_reclaim_populated()
  2022-10-24  8:14 ` [PATCH 2/8] mm/percpu: use list_first_entry_or_null in pcpu_reclaim_populated() Baoquan He
@ 2022-10-24 10:17   ` kernel test robot
  2022-10-24 16:52   ` Dennis Zhou
  2022-10-25  3:11   ` [PATCH v2 " Baoquan He
  2 siblings, 0 replies; 29+ messages in thread
From: kernel test robot @ 2022-10-24 10:17 UTC (permalink / raw)
  To: Baoquan He, linux-kernel
  Cc: kbuild-all, Dennis Zhou, Tejun Heo, Christoph Lameter,
	Andrew Morton, Linux Memory Management List, Baoquan He

[-- Attachment #1: Type: text/plain, Size: 5722 bytes --]

Hi Baoquan,

I love your patch! Perhaps something to improve:

[auto build test WARNING on vbabka-slab/for-next]
[also build test WARNING on akpm-mm/mm-everything linus/master v6.1-rc2 next-20221024]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Baoquan-He/Cleanup-and-optimization-patches-for-percpu/20221024-161636
base:   git://git.kernel.org/pub/scm/linux/kernel/git/vbabka/slab.git for-next
patch link:    https://lore.kernel.org/r/20221024081435.204970-3-bhe%40redhat.com
patch subject: [PATCH 2/8] mm/percpu: use list_first_entry_or_null in pcpu_reclaim_populated()
config: um-i386_defconfig
compiler: gcc-11 (Debian 11.3.0-8) 11.3.0
reproduce (this is a W=1 build):
        # https://github.com/intel-lab-lkp/linux/commit/75b290e1aa943a113526ab78c22b38d07bf7a462
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Baoquan-He/Cleanup-and-optimization-patches-for-percpu/20221024-161636
        git checkout 75b290e1aa943a113526ab78c22b38d07bf7a462
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        make W=1 O=build_dir ARCH=um SUBARCH=i386 SHELL=/bin/bash

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   mm/percpu.c: In function 'pcpu_reclaim_populated':
>> mm/percpu.c:2146:16: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
    2146 |         while (chunk = list_first_entry_or_null(
         |                ^~~~~


vim +2146 mm/percpu.c

  2114	
  2115	/**
  2116	 * pcpu_reclaim_populated - scan over to_depopulate chunks and free empty pages
  2117	 *
  2118	 * Scan over chunks in the depopulate list and try to release unused populated
  2119	 * pages back to the system.  Depopulated chunks are sidelined to prevent
  2120	 * repopulating these pages unless required.  Fully free chunks are reintegrated
  2121	 * and freed accordingly (1 is kept around).  If we drop below the empty
  2122	 * populated pages threshold, reintegrate the chunk if it has empty free pages.
  2123	 * Each chunk is scanned in the reverse order to keep populated pages close to
  2124	 * the beginning of the chunk.
  2125	 *
  2126	 * CONTEXT:
  2127	 * pcpu_lock (can be dropped temporarily)
  2128	 *
  2129	 */
  2130	static void pcpu_reclaim_populated(void)
  2131	{
  2132		struct pcpu_chunk *chunk;
  2133		struct pcpu_block_md *block;
  2134		int freed_page_start, freed_page_end;
  2135		int i, end;
  2136		bool reintegrate;
  2137	
  2138		lockdep_assert_held(&pcpu_lock);
  2139	
  2140		/*
  2141		 * Once a chunk is isolated to the to_depopulate list, the chunk is no
  2142		 * longer discoverable to allocations whom may populate pages.  The only
  2143		 * other accessor is the free path which only returns area back to the
  2144		 * allocator not touching the populated bitmap.
  2145		 */
> 2146		while (chunk = list_first_entry_or_null(
  2147				&pcpu_chunk_lists[pcpu_to_depopulate_slot],
  2148				struct pcpu_chunk, list)) {
  2149			WARN_ON(chunk->immutable);
  2150	
  2151			/*
  2152			 * Scan chunk's pages in the reverse order to keep populated
  2153			 * pages close to the beginning of the chunk.
  2154			 */
  2155			freed_page_start = chunk->nr_pages;
  2156			freed_page_end = 0;
  2157			reintegrate = false;
  2158			for (i = chunk->nr_pages - 1, end = -1; i >= 0; i--) {
  2159				/* no more work to do */
  2160				if (chunk->nr_empty_pop_pages == 0)
  2161					break;
  2162	
  2163				/* reintegrate chunk to prevent atomic alloc failures */
  2164				if (pcpu_nr_empty_pop_pages < PCPU_EMPTY_POP_PAGES_HIGH) {
  2165					reintegrate = true;
  2166					goto end_chunk;
  2167				}
  2168	
  2169				/*
  2170				 * If the page is empty and populated, start or
  2171				 * extend the (i, end) range.  If i == 0, decrease
  2172				 * i and perform the depopulation to cover the last
  2173				 * (first) page in the chunk.
  2174				 */
  2175				block = chunk->md_blocks + i;
  2176				if (block->contig_hint == PCPU_BITMAP_BLOCK_BITS &&
  2177				    test_bit(i, chunk->populated)) {
  2178					if (end == -1)
  2179						end = i;
  2180					if (i > 0)
  2181						continue;
  2182					i--;
  2183				}
  2184	
  2185				/* depopulate if there is an active range */
  2186				if (end == -1)
  2187					continue;
  2188	
  2189				spin_unlock_irq(&pcpu_lock);
  2190				pcpu_depopulate_chunk(chunk, i + 1, end + 1);
  2191				cond_resched();
  2192				spin_lock_irq(&pcpu_lock);
  2193	
  2194				pcpu_chunk_depopulated(chunk, i + 1, end + 1);
  2195				freed_page_start = min(freed_page_start, i + 1);
  2196				freed_page_end = max(freed_page_end, end + 1);
  2197	
  2198				/* reset the range and continue */
  2199				end = -1;
  2200			}
  2201	
  2202	end_chunk:
  2203			/* batch tlb flush per chunk to amortize cost */
  2204			if (freed_page_start < freed_page_end) {
  2205				spin_unlock_irq(&pcpu_lock);
  2206				pcpu_post_unmap_tlb_flush(chunk,
  2207							  freed_page_start,
  2208							  freed_page_end);
  2209				cond_resched();
  2210				spin_lock_irq(&pcpu_lock);
  2211			}
  2212	
  2213			if (reintegrate || chunk->free_bytes == pcpu_unit_size)
  2214				pcpu_reintegrate_chunk(chunk);
  2215			else
  2216				list_move_tail(&chunk->list,
  2217					       &pcpu_chunk_lists[pcpu_sidelined_slot]);
  2218		}
  2219	}
  2220	

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

[-- Attachment #2: config --]
[-- Type: text/plain, Size: 41263 bytes --]

#
# Automatically generated file; DO NOT EDIT.
# Linux/um 6.0.0-rc2 Kernel Configuration
#
CONFIG_CC_VERSION_TEXT="gcc-11 (Debian 11.3.0-8) 11.3.0"
CONFIG_CC_IS_GCC=y
CONFIG_GCC_VERSION=110300
CONFIG_CLANG_VERSION=0
CONFIG_AS_IS_GNU=y
CONFIG_AS_VERSION=23900
CONFIG_LD_IS_BFD=y
CONFIG_LD_VERSION=23900
CONFIG_LLD_VERSION=0
CONFIG_CC_CAN_LINK=y
CONFIG_CC_CAN_LINK_STATIC=y
CONFIG_CC_HAS_ASM_GOTO_OUTPUT=y
CONFIG_CC_HAS_ASM_INLINE=y
CONFIG_CC_HAS_NO_PROFILE_FN_ATTR=y
CONFIG_PAHOLE_VERSION=123
CONFIG_IRQ_WORK=y

#
# General setup
#
CONFIG_BROKEN_ON_SMP=y
CONFIG_INIT_ENV_ARG_LIMIT=128
# CONFIG_WERROR is not set
CONFIG_LOCALVERSION=""
CONFIG_LOCALVERSION_AUTO=y
CONFIG_BUILD_SALT=""
CONFIG_DEFAULT_INIT=""
CONFIG_DEFAULT_HOSTNAME="(none)"
CONFIG_SYSVIPC=y
CONFIG_SYSVIPC_SYSCTL=y
CONFIG_POSIX_MQUEUE=y
CONFIG_POSIX_MQUEUE_SYSCTL=y
# CONFIG_WATCH_QUEUE is not set
CONFIG_CROSS_MEMORY_ATTACH=y
# CONFIG_USELIB is not set
# CONFIG_AUDIT is not set
CONFIG_HAVE_ARCH_AUDITSYSCALL=y

#
# IRQ subsystem
#
CONFIG_GENERIC_IRQ_SHOW=y
# end of IRQ subsystem

CONFIG_GENERIC_CLOCKEVENTS=y

#
# Timers subsystem
#
CONFIG_TICK_ONESHOT=y
CONFIG_NO_HZ_COMMON=y
# CONFIG_HZ_PERIODIC is not set
CONFIG_NO_HZ_IDLE=y
CONFIG_NO_HZ=y
CONFIG_HIGH_RES_TIMERS=y
# end of Timers subsystem

CONFIG_BPF=y

#
# BPF subsystem
#
# CONFIG_BPF_SYSCALL is not set
# end of BPF subsystem

CONFIG_PREEMPT_NONE_BUILD=y
CONFIG_PREEMPT_NONE=y

#
# CPU/Task time and stats accounting
#
CONFIG_TICK_CPU_ACCOUNTING=y
CONFIG_BSD_PROCESS_ACCT=y
# CONFIG_BSD_PROCESS_ACCT_V3 is not set
# CONFIG_TASKSTATS is not set
# CONFIG_PSI is not set
# end of CPU/Task time and stats accounting

#
# RCU Subsystem
#
CONFIG_TINY_RCU=y
# CONFIG_RCU_EXPERT is not set
CONFIG_SRCU=y
CONFIG_TINY_SRCU=y
# end of RCU Subsystem

CONFIG_IKCONFIG=y
CONFIG_IKCONFIG_PROC=y
# CONFIG_IKHEADERS is not set
CONFIG_LOG_BUF_SHIFT=14
CONFIG_PRINTK_SAFE_LOG_BUF_SHIFT=13

#
# Scheduler features
#
# end of Scheduler features

CONFIG_CC_IMPLICIT_FALLTHROUGH="-Wimplicit-fallthrough=5"
CONFIG_GCC12_NO_ARRAY_BOUNDS=y
CONFIG_CGROUPS=y
# CONFIG_CGROUP_FAVOR_DYNMODS is not set
# CONFIG_MEMCG is not set
CONFIG_BLK_CGROUP=y
CONFIG_CGROUP_SCHED=y
CONFIG_FAIR_GROUP_SCHED=y
# CONFIG_CFS_BANDWIDTH is not set
# CONFIG_RT_GROUP_SCHED is not set
# CONFIG_CGROUP_PIDS is not set
# CONFIG_CGROUP_RDMA is not set
CONFIG_CGROUP_FREEZER=y
CONFIG_CGROUP_DEVICE=y
CONFIG_CGROUP_CPUACCT=y
# CONFIG_CGROUP_MISC is not set
# CONFIG_CGROUP_DEBUG is not set
CONFIG_NAMESPACES=y
CONFIG_UTS_NS=y
CONFIG_IPC_NS=y
# CONFIG_USER_NS is not set
# CONFIG_PID_NS is not set
CONFIG_NET_NS=y
# CONFIG_CHECKPOINT_RESTORE is not set
# CONFIG_SCHED_AUTOGROUP is not set
CONFIG_SYSFS_DEPRECATED=y
# CONFIG_SYSFS_DEPRECATED_V2 is not set
# CONFIG_RELAY is not set
# CONFIG_BLK_DEV_INITRD is not set
# CONFIG_BOOT_CONFIG is not set
CONFIG_INITRAMFS_PRESERVE_MTIME=y
# CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE is not set
CONFIG_CC_OPTIMIZE_FOR_SIZE=y
CONFIG_SYSCTL=y
CONFIG_HAVE_UID16=y
# CONFIG_EXPERT is not set
CONFIG_UID16=y
CONFIG_MULTIUSER=y
CONFIG_SYSFS_SYSCALL=y
CONFIG_FHANDLE=y
CONFIG_POSIX_TIMERS=y
CONFIG_PRINTK=y
CONFIG_BUG=y
CONFIG_ELF_CORE=y
CONFIG_BASE_FULL=y
CONFIG_FUTEX=y
CONFIG_FUTEX_PI=y
CONFIG_EPOLL=y
CONFIG_SIGNALFD=y
CONFIG_TIMERFD=y
CONFIG_EVENTFD=y
CONFIG_SHMEM=y
CONFIG_AIO=y
CONFIG_IO_URING=y
CONFIG_ADVISE_SYSCALLS=y
CONFIG_MEMBARRIER=y
CONFIG_KALLSYMS=y
# CONFIG_KALLSYMS_ALL is not set
CONFIG_KALLSYMS_BASE_RELATIVE=y
# CONFIG_EMBEDDED is not set

#
# Kernel Performance Events And Counters
#
# end of Kernel Performance Events And Counters

# CONFIG_PROFILING is not set
# end of General setup

#
# UML-specific options
#
CONFIG_UML=y
CONFIG_MMU=y
CONFIG_NO_IOMEM=y
CONFIG_NO_IOPORT_MAP=y
CONFIG_LOCKDEP_SUPPORT=y
CONFIG_STACKTRACE_SUPPORT=y
CONFIG_GENERIC_CALIBRATE_DELAY=y
CONFIG_HZ=100
CONFIG_NR_CPUS=1
CONFIG_ARCH_HAS_CACHE_LINE_SIZE=y

#
# Host processor type and features
#
# CONFIG_M486SX is not set
# CONFIG_M486 is not set
# CONFIG_M586 is not set
# CONFIG_M586TSC is not set
# CONFIG_M586MMX is not set
CONFIG_M686=y
# CONFIG_MPENTIUMII is not set
# CONFIG_MPENTIUMIII is not set
# CONFIG_MPENTIUMM is not set
# CONFIG_MPENTIUM4 is not set
# CONFIG_MK6 is not set
# CONFIG_MK7 is not set
# CONFIG_MK8 is not set
# CONFIG_MCRUSOE is not set
# CONFIG_MEFFICEON is not set
# CONFIG_MWINCHIPC6 is not set
# CONFIG_MWINCHIP3D is not set
# CONFIG_MELAN is not set
# CONFIG_MGEODEGX1 is not set
# CONFIG_MGEODE_LX is not set
# CONFIG_MCYRIXIII is not set
# CONFIG_MVIAC3_2 is not set
# CONFIG_MVIAC7 is not set
# CONFIG_MCORE2 is not set
# CONFIG_MATOM is not set
# CONFIG_X86_GENERIC is not set
CONFIG_X86_INTERNODE_CACHE_SHIFT=5
CONFIG_X86_L1_CACHE_SHIFT=5
CONFIG_X86_USE_PPRO_CHECKSUM=y
CONFIG_X86_TSC=y
CONFIG_X86_CMPXCHG64=y
CONFIG_X86_CMOV=y
CONFIG_X86_MINIMUM_CPU_FAMILY=6
CONFIG_IA32_FEAT_CTL=y
CONFIG_CPU_SUP_INTEL=y
CONFIG_CPU_SUP_AMD=y
CONFIG_CPU_SUP_HYGON=y
CONFIG_CPU_SUP_CENTAUR=y
CONFIG_CPU_SUP_TRANSMETA_32=y
CONFIG_CPU_SUP_ZHAOXIN=y
CONFIG_CPU_SUP_VORTEX_32=y
# end of Host processor type and features

CONFIG_UML_X86=y
CONFIG_X86_32=y
CONFIG_3_LEVEL_PGTABLES=y
CONFIG_ARCH_HAS_SC_SIGNALS=y
CONFIG_ARCH_REUSE_HOST_VSYSCALL_AREA=y
CONFIG_GENERIC_HWEIGHT=y
# CONFIG_STATIC_LINK is not set
CONFIG_LD_SCRIPT_DYN=y
CONFIG_LD_SCRIPT_DYN_RPATH=y
CONFIG_HOSTFS=y
CONFIG_MCONSOLE=y
CONFIG_MAGIC_SYSRQ=y
CONFIG_KERNEL_STACK_ORDER=1
# CONFIG_MMAPPER is not set
CONFIG_PGTABLE_LEVELS=3
# CONFIG_UML_TIME_TRAVEL_SUPPORT is not set
# end of UML-specific options

#
# UML Character Devices
#
CONFIG_STDERR_CONSOLE=y
CONFIG_SSL=y
CONFIG_NULL_CHAN=y
CONFIG_PORT_CHAN=y
CONFIG_PTY_CHAN=y
CONFIG_TTY_CHAN=y
CONFIG_XTERM_CHAN=y
CONFIG_XTERM_CHAN_DEFAULT_EMULATOR="xterm"
CONFIG_CON_ZERO_CHAN="fd:0,fd:1"
CONFIG_CON_CHAN="pts"
CONFIG_SSL_CHAN="pts"
CONFIG_UML_SOUND=m
CONFIG_SOUND=m
CONFIG_SOUND_OSS_CORE=y
CONFIG_HOSTAUDIO=m
# end of UML Character Devices

#
# UML Network Devices
#
CONFIG_UML_NET=y
CONFIG_UML_NET_ETHERTAP=y
CONFIG_UML_NET_TUNTAP=y
CONFIG_UML_NET_SLIP=y
CONFIG_UML_NET_DAEMON=y
CONFIG_UML_NET_DAEMON_DEFAULT_SOCK="/tmp/uml.ctl"
# CONFIG_UML_NET_VECTOR is not set
# CONFIG_UML_NET_VDE is not set
CONFIG_UML_NET_MCAST=y
# CONFIG_UML_NET_PCAP is not set
CONFIG_UML_NET_SLIRP=y
# end of UML Network Devices

# CONFIG_VIRTIO_UML is not set
CONFIG_ARCH_SUSPEND_POSSIBLE=y
CONFIG_SUSPEND=y
CONFIG_SUSPEND_FREEZER=y
CONFIG_PM_SLEEP=y
# CONFIG_PM_AUTOSLEEP is not set
# CONFIG_PM_USERSPACE_AUTOSLEEP is not set
# CONFIG_PM_WAKELOCKS is not set
CONFIG_PM=y
# CONFIG_PM_DEBUG is not set
# CONFIG_WQ_POWER_EFFICIENT_DEFAULT is not set

#
# General architecture-dependent options
#
CONFIG_CRASH_CORE=y
CONFIG_TRACE_IRQFLAGS_SUPPORT=y
CONFIG_ARCH_32BIT_OFF_T=y
CONFIG_HAVE_ASM_MODVERSIONS=y
CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y
CONFIG_HAVE_ARCH_SECCOMP=y
CONFIG_HAVE_ARCH_SECCOMP_FILTER=y
CONFIG_SECCOMP=y
CONFIG_SECCOMP_FILTER=y
# CONFIG_SECCOMP_CACHE_DEBUG is not set
CONFIG_LTO_NONE=y
CONFIG_MODULES_USE_ELF_REL=y
CONFIG_PAGE_SIZE_LESS_THAN_64KB=y
CONFIG_PAGE_SIZE_LESS_THAN_256KB=y
CONFIG_CLONE_BACKWARDS=y
CONFIG_OLD_SIGSUSPEND3=y
CONFIG_OLD_SIGACTION=y
CONFIG_COMPAT_32BIT_TIME=y
CONFIG_ARCH_NO_PREEMPT=y
CONFIG_ARCH_EPHEMERAL_INODES=y
CONFIG_HAVE_ARCH_VMAP_STACK=y
CONFIG_VMAP_STACK=y

#
# GCOV-based kernel profiling
#
CONFIG_ARCH_HAS_GCOV_PROFILE_ALL=y
# end of GCOV-based kernel profiling

CONFIG_HAVE_GCC_PLUGINS=y
CONFIG_GCC_PLUGINS=y
# CONFIG_GCC_PLUGIN_LATENT_ENTROPY is not set
# end of General architecture-dependent options

CONFIG_RT_MUTEXES=y
CONFIG_BASE_SMALL=0
CONFIG_MODULES=y
# CONFIG_MODULE_FORCE_LOAD is not set
CONFIG_MODULE_UNLOAD=y
# CONFIG_MODULE_FORCE_UNLOAD is not set
# CONFIG_MODULE_UNLOAD_TAINT_TRACKING is not set
# CONFIG_MODVERSIONS is not set
# CONFIG_MODULE_SRCVERSION_ALL is not set
# CONFIG_MODULE_SIG is not set
CONFIG_MODULE_COMPRESS_NONE=y
# CONFIG_MODULE_COMPRESS_GZIP is not set
# CONFIG_MODULE_COMPRESS_XZ is not set
# CONFIG_MODULE_COMPRESS_ZSTD is not set
# CONFIG_MODULE_ALLOW_MISSING_NAMESPACE_IMPORTS is not set
CONFIG_MODPROBE_PATH="/sbin/modprobe"
CONFIG_BLOCK=y
CONFIG_BLOCK_LEGACY_AUTOLOAD=y
CONFIG_BLK_ICQ=y
# CONFIG_BLK_DEV_BSGLIB is not set
# CONFIG_BLK_DEV_INTEGRITY is not set
# CONFIG_BLK_DEV_ZONED is not set
# CONFIG_BLK_DEV_THROTTLING is not set
# CONFIG_BLK_WBT is not set
# CONFIG_BLK_CGROUP_IOLATENCY is not set
# CONFIG_BLK_CGROUP_IOCOST is not set
# CONFIG_BLK_CGROUP_IOPRIO is not set
# CONFIG_BLK_SED_OPAL is not set
# CONFIG_BLK_INLINE_ENCRYPTION is not set

#
# Partition Types
#
# CONFIG_PARTITION_ADVANCED is not set
CONFIG_MSDOS_PARTITION=y
CONFIG_EFI_PARTITION=y
# end of Partition Types

CONFIG_BLK_PM=y

#
# IO Schedulers
#
CONFIG_MQ_IOSCHED_DEADLINE=y
CONFIG_MQ_IOSCHED_KYBER=y
CONFIG_IOSCHED_BFQ=m
# CONFIG_BFQ_GROUP_IOSCHED is not set
# end of IO Schedulers

CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
CONFIG_INLINE_READ_UNLOCK=y
CONFIG_INLINE_READ_UNLOCK_IRQ=y
CONFIG_INLINE_WRITE_UNLOCK=y
CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
CONFIG_FREEZER=y

#
# Executable file formats
#
CONFIG_BINFMT_ELF=y
CONFIG_ARCH_BINFMT_ELF_EXTRA_PHDRS=y
CONFIG_ELFCORE=y
CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS=y
CONFIG_BINFMT_SCRIPT=y
CONFIG_BINFMT_MISC=m
CONFIG_COREDUMP=y
# end of Executable file formats

#
# Memory Management options
#
CONFIG_SWAP=y
# CONFIG_ZSWAP is not set

#
# SLAB allocator options
#
CONFIG_SLAB=y
# CONFIG_SLUB is not set
CONFIG_SLAB_MERGE_DEFAULT=y
# CONFIG_SLAB_FREELIST_RANDOM is not set
# CONFIG_SLAB_FREELIST_HARDENED is not set
# end of SLAB allocator options

# CONFIG_SHUFFLE_PAGE_ALLOCATOR is not set
CONFIG_COMPAT_BRK=y
CONFIG_FLATMEM=y
CONFIG_SPLIT_PTLOCK_CPUS=4
# CONFIG_COMPACTION is not set
# CONFIG_PAGE_REPORTING is not set
# CONFIG_KSM is not set
CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
CONFIG_NEED_PER_CPU_KM=y
# CONFIG_CMA is not set
# CONFIG_IDLE_PAGE_TRACKING is not set
CONFIG_VM_EVENT_COUNTERS=y
# CONFIG_PERCPU_STATS is not set

#
# GUP_TEST needs to have DEBUG_FS enabled
#
# CONFIG_ANON_VMA_NAME is not set
# CONFIG_USERFAULTFD is not set

#
# Data Access Monitoring
#
# CONFIG_DAMON is not set
# end of Data Access Monitoring
# end of Memory Management options

CONFIG_NET=y

#
# Networking options
#
CONFIG_PACKET=y
# CONFIG_PACKET_DIAG is not set
CONFIG_UNIX=y
CONFIG_UNIX_SCM=y
CONFIG_AF_UNIX_OOB=y
# CONFIG_UNIX_DIAG is not set
# CONFIG_TLS is not set
# CONFIG_XFRM_USER is not set
# CONFIG_NET_KEY is not set
CONFIG_INET=y
# CONFIG_IP_MULTICAST is not set
# CONFIG_IP_ADVANCED_ROUTER is not set
# CONFIG_IP_PNP is not set
# CONFIG_NET_IPIP is not set
# CONFIG_NET_IPGRE_DEMUX is not set
# CONFIG_SYN_COOKIES is not set
# CONFIG_NET_IPVTI is not set
# CONFIG_NET_FOU is not set
# CONFIG_INET_AH is not set
# CONFIG_INET_ESP is not set
# CONFIG_INET_IPCOMP is not set
CONFIG_INET_DIAG=y
CONFIG_INET_TCP_DIAG=y
# CONFIG_INET_UDP_DIAG is not set
# CONFIG_INET_RAW_DIAG is not set
# CONFIG_INET_DIAG_DESTROY is not set
# CONFIG_TCP_CONG_ADVANCED is not set
CONFIG_TCP_CONG_CUBIC=y
CONFIG_DEFAULT_TCP_CONG="cubic"
# CONFIG_TCP_MD5SIG is not set
# CONFIG_IPV6 is not set
# CONFIG_MPTCP is not set
# CONFIG_NETWORK_SECMARK is not set
CONFIG_NET_PTP_CLASSIFY=y
# CONFIG_NETWORK_PHY_TIMESTAMPING is not set
# CONFIG_NETFILTER is not set
# CONFIG_BPFILTER is not set
# CONFIG_IP_DCCP is not set
# CONFIG_IP_SCTP is not set
# CONFIG_RDS is not set
# CONFIG_TIPC is not set
# CONFIG_ATM is not set
# CONFIG_L2TP is not set
# CONFIG_BRIDGE is not set
# CONFIG_NET_DSA is not set
# CONFIG_VLAN_8021Q is not set
# CONFIG_DECNET is not set
# CONFIG_LLC2 is not set
# CONFIG_ATALK is not set
# CONFIG_X25 is not set
# CONFIG_LAPB is not set
# CONFIG_PHONET is not set
# CONFIG_IEEE802154 is not set
# CONFIG_NET_SCHED is not set
# CONFIG_DCB is not set
# CONFIG_BATMAN_ADV is not set
# CONFIG_OPENVSWITCH is not set
# CONFIG_VSOCKETS is not set
# CONFIG_NETLINK_DIAG is not set
# CONFIG_MPLS is not set
# CONFIG_NET_NSH is not set
# CONFIG_HSR is not set
# CONFIG_NET_SWITCHDEV is not set
# CONFIG_NET_L3_MASTER_DEV is not set
# CONFIG_QRTR is not set
# CONFIG_NET_NCSI is not set
# CONFIG_CGROUP_NET_PRIO is not set
# CONFIG_CGROUP_NET_CLASSID is not set
CONFIG_NET_RX_BUSY_POLL=y
CONFIG_BQL=y

#
# Network testing
#
# CONFIG_NET_PKTGEN is not set
# end of Network testing
# end of Networking options

# CONFIG_HAMRADIO is not set
# CONFIG_CAN is not set
# CONFIG_BT is not set
# CONFIG_AF_RXRPC is not set
# CONFIG_AF_KCM is not set
# CONFIG_MCTP is not set
CONFIG_WIRELESS=y
# CONFIG_CFG80211 is not set

#
# CFG80211 needs to be enabled for MAC80211
#
CONFIG_MAC80211_STA_HASH_MAX_SIZE=0
# CONFIG_RFKILL is not set
# CONFIG_NET_9P is not set
# CONFIG_CAIF is not set
# CONFIG_CEPH_LIB is not set
# CONFIG_NFC is not set
# CONFIG_PSAMPLE is not set
# CONFIG_NET_IFE is not set
# CONFIG_LWTUNNEL is not set
# CONFIG_FAILOVER is not set
CONFIG_ETHTOOL_NETLINK=y

#
# Device Drivers
#

#
# Generic Driver Options
#
# CONFIG_UEVENT_HELPER is not set
CONFIG_DEVTMPFS=y
CONFIG_DEVTMPFS_MOUNT=y
# CONFIG_DEVTMPFS_SAFE is not set
CONFIG_STANDALONE=y
CONFIG_PREVENT_FIRMWARE_BUILD=y

#
# Firmware loader
#
CONFIG_FW_LOADER=y
CONFIG_EXTRA_FIRMWARE=""
# CONFIG_FW_LOADER_USER_HELPER is not set
# CONFIG_FW_LOADER_COMPRESS is not set
CONFIG_FW_CACHE=y
# CONFIG_FW_UPLOAD is not set
# end of Firmware loader

CONFIG_ALLOW_DEV_COREDUMP=y
# CONFIG_DEBUG_DRIVER is not set
# CONFIG_DEBUG_DEVRES is not set
# CONFIG_DEBUG_TEST_DRIVER_REMOVE is not set
# CONFIG_TEST_ASYNC_DRIVER_PROBE is not set
CONFIG_GENERIC_CPU_DEVICES=y
# end of Generic Driver Options

#
# Bus devices
#
# CONFIG_MHI_BUS is not set
# CONFIG_MHI_BUS_EP is not set
# end of Bus devices

# CONFIG_CONNECTOR is not set

#
# Firmware Drivers
#

#
# ARM System Control and Management Interface Protocol
#
# end of ARM System Control and Management Interface Protocol

# CONFIG_GOOGLE_FIRMWARE is not set

#
# Tegra firmware driver
#
# end of Tegra firmware driver
# end of Firmware Drivers

# CONFIG_GNSS is not set
# CONFIG_MTD is not set
# CONFIG_OF is not set
CONFIG_BLK_DEV=y
# CONFIG_BLK_DEV_NULL_BLK is not set
CONFIG_BLK_DEV_UBD=y
# CONFIG_BLK_DEV_UBD_SYNC is not set
CONFIG_BLK_DEV_COW_COMMON=y
CONFIG_BLK_DEV_LOOP=m
CONFIG_BLK_DEV_LOOP_MIN_COUNT=8
# CONFIG_BLK_DEV_DRBD is not set
CONFIG_BLK_DEV_NBD=m
# CONFIG_BLK_DEV_RAM is not set
# CONFIG_ATA_OVER_ETH is not set
# CONFIG_BLK_DEV_RBD is not set
# CONFIG_BLK_DEV_UBLK is not set

#
# NVME Support
#
# CONFIG_NVME_TCP is not set
# end of NVME Support

#
# Misc devices
#
# CONFIG_DUMMY_IRQ is not set
# CONFIG_ENCLOSURE_SERVICES is not set
# CONFIG_C2PORT is not set

#
# EEPROM support
#
# CONFIG_EEPROM_93CX6 is not set
# end of EEPROM support

#
# Texas Instruments shared transport line discipline
#
# end of Texas Instruments shared transport line discipline

#
# Altera FPGA firmware download module (requires I2C)
#
# CONFIG_ECHO is not set
# CONFIG_PVPANIC is not set
# end of Misc devices

#
# SCSI device support
#
CONFIG_SCSI_MOD=y
# CONFIG_RAID_ATTRS is not set
# CONFIG_SCSI is not set
# end of SCSI device support

# CONFIG_MD is not set
# CONFIG_TARGET_CORE is not set
CONFIG_NETDEVICES=y
CONFIG_NET_CORE=y
# CONFIG_BONDING is not set
CONFIG_DUMMY=m
# CONFIG_WIREGUARD is not set
# CONFIG_EQUALIZER is not set
# CONFIG_NET_TEAM is not set
# CONFIG_MACVLAN is not set
# CONFIG_IPVLAN is not set
# CONFIG_VXLAN is not set
# CONFIG_GENEVE is not set
# CONFIG_BAREUDP is not set
# CONFIG_GTP is not set
# CONFIG_MACSEC is not set
# CONFIG_NETCONSOLE is not set
CONFIG_TUN=m
# CONFIG_TUN_VNET_CROSS_LE is not set
# CONFIG_VETH is not set
# CONFIG_NLMON is not set
CONFIG_ETHERNET=y
CONFIG_NET_VENDOR_ALACRITECH=y
CONFIG_NET_VENDOR_AMAZON=y
CONFIG_NET_VENDOR_AQUANTIA=y
CONFIG_NET_VENDOR_ARC=y
CONFIG_NET_VENDOR_ASIX=y
CONFIG_NET_VENDOR_CAVIUM=y
CONFIG_NET_VENDOR_CORTINA=y
CONFIG_NET_VENDOR_DAVICOM=y
CONFIG_NET_VENDOR_ENGLEDER=y
CONFIG_NET_VENDOR_EZCHIP=y
CONFIG_NET_VENDOR_FUNGIBLE=y
CONFIG_NET_VENDOR_GOOGLE=y
CONFIG_NET_VENDOR_HUAWEI=y
CONFIG_NET_VENDOR_I825XX=y
CONFIG_NET_VENDOR_INTEL=y
CONFIG_NET_VENDOR_WANGXUN=y
CONFIG_NET_VENDOR_LITEX=y
CONFIG_NET_VENDOR_MARVELL=y
CONFIG_NET_VENDOR_MICROCHIP=y
CONFIG_NET_VENDOR_MICROSEMI=y
CONFIG_NET_VENDOR_MICROSOFT=y
CONFIG_NET_VENDOR_NI=y
CONFIG_NET_VENDOR_NATSEMI=y
CONFIG_NET_VENDOR_NETRONOME=y
CONFIG_NET_VENDOR_8390=y
CONFIG_NET_VENDOR_PENSANDO=y
CONFIG_NET_VENDOR_QUALCOMM=y
# CONFIG_RMNET is not set
CONFIG_NET_VENDOR_RENESAS=y
CONFIG_NET_VENDOR_ROCKER=y
CONFIG_NET_VENDOR_SAMSUNG=y
CONFIG_NET_VENDOR_SOLARFLARE=y
CONFIG_NET_VENDOR_SOCIONEXT=y
CONFIG_NET_VENDOR_SYNOPSYS=y
CONFIG_NET_VENDOR_VERTEXCOM=y
CONFIG_NET_VENDOR_VIA=y
CONFIG_NET_VENDOR_XILINX=y
# CONFIG_PHYLIB is not set
# CONFIG_MDIO_DEVICE is not set

#
# PCS device drivers
#
# end of PCS device drivers

CONFIG_PPP=m
# CONFIG_PPP_BSDCOMP is not set
# CONFIG_PPP_DEFLATE is not set
# CONFIG_PPP_FILTER is not set
# CONFIG_PPP_MPPE is not set
# CONFIG_PPP_MULTILINK is not set
# CONFIG_PPPOE is not set
# CONFIG_PPP_ASYNC is not set
# CONFIG_PPP_SYNC_TTY is not set
CONFIG_SLIP=m
CONFIG_SLHC=m
# CONFIG_SLIP_COMPRESSED is not set
# CONFIG_SLIP_SMART is not set
# CONFIG_SLIP_MODE_SLIP6 is not set

#
# Host-side USB support is needed for USB Network Adapter support
#
CONFIG_WLAN=y
CONFIG_WLAN_VENDOR_ADMTEK=y
CONFIG_WLAN_VENDOR_ATH=y
# CONFIG_ATH_DEBUG is not set
CONFIG_WLAN_VENDOR_ATMEL=y
CONFIG_WLAN_VENDOR_BROADCOM=y
CONFIG_WLAN_VENDOR_CISCO=y
CONFIG_WLAN_VENDOR_INTEL=y
CONFIG_WLAN_VENDOR_INTERSIL=y
# CONFIG_HOSTAP is not set
CONFIG_WLAN_VENDOR_MARVELL=y
CONFIG_WLAN_VENDOR_MEDIATEK=y
CONFIG_WLAN_VENDOR_MICROCHIP=y
CONFIG_WLAN_VENDOR_PURELIFI=y
CONFIG_WLAN_VENDOR_RALINK=y
CONFIG_WLAN_VENDOR_REALTEK=y
CONFIG_WLAN_VENDOR_RSI=y
CONFIG_WLAN_VENDOR_SILABS=y
CONFIG_WLAN_VENDOR_ST=y
CONFIG_WLAN_VENDOR_TI=y
CONFIG_WLAN_VENDOR_ZYDAS=y
CONFIG_WLAN_VENDOR_QUANTENNA=y
# CONFIG_WAN is not set

#
# Wireless WAN
#
# CONFIG_WWAN is not set
# end of Wireless WAN

# CONFIG_NET_FAILOVER is not set

#
# Input device support
#
CONFIG_INPUT=y
CONFIG_INPUT_FF_MEMLESS=y
# CONFIG_INPUT_SPARSEKMAP is not set
# CONFIG_INPUT_MATRIXKMAP is not set
CONFIG_INPUT_VIVALDIFMAP=y

#
# Userland interfaces
#
# CONFIG_INPUT_MOUSEDEV is not set
# CONFIG_INPUT_JOYDEV is not set
# CONFIG_INPUT_EVDEV is not set
# CONFIG_INPUT_EVBUG is not set

#
# Input Device Drivers
#
CONFIG_INPUT_KEYBOARD=y
CONFIG_KEYBOARD_ATKBD=y
# CONFIG_KEYBOARD_LKKBD is not set
# CONFIG_KEYBOARD_NEWTON is not set
# CONFIG_KEYBOARD_STOWAWAY is not set
# CONFIG_KEYBOARD_SUNKBD is not set
# CONFIG_KEYBOARD_XTKBD is not set
CONFIG_INPUT_MOUSE=y
CONFIG_MOUSE_PS2=y
CONFIG_MOUSE_PS2_ALPS=y
CONFIG_MOUSE_PS2_BYD=y
CONFIG_MOUSE_PS2_LOGIPS2PP=y
CONFIG_MOUSE_PS2_SYNAPTICS=y
CONFIG_MOUSE_PS2_CYPRESS=y
CONFIG_MOUSE_PS2_TRACKPOINT=y
# CONFIG_MOUSE_PS2_ELANTECH is not set
# CONFIG_MOUSE_PS2_SENTELIC is not set
# CONFIG_MOUSE_PS2_TOUCHKIT is not set
CONFIG_MOUSE_PS2_FOCALTECH=y
# CONFIG_MOUSE_SERIAL is not set
# CONFIG_MOUSE_VSXXXAA is not set
# CONFIG_INPUT_TABLET is not set
# CONFIG_INPUT_TOUCHSCREEN is not set
# CONFIG_INPUT_MISC is not set
# CONFIG_RMI4_CORE is not set

#
# Hardware I/O ports
#
CONFIG_SERIO=y
CONFIG_SERIO_SERPORT=y
CONFIG_SERIO_LIBPS2=y
# CONFIG_SERIO_RAW is not set
# CONFIG_SERIO_PS2MULT is not set
# CONFIG_USERIO is not set
# end of Hardware I/O ports
# end of Input device support

#
# Character devices
#
CONFIG_TTY=y
CONFIG_UNIX98_PTYS=y
CONFIG_LEGACY_PTYS=y
CONFIG_LEGACY_PTY_COUNT=32
CONFIG_LDISC_AUTOLOAD=y
# CONFIG_N_GSM is not set
# CONFIG_NULL_TTY is not set
# CONFIG_SERIAL_DEV_BUS is not set
# CONFIG_VIRTIO_CONSOLE is not set
CONFIG_HW_RANDOM=y
CONFIG_UML_RANDOM=y
# CONFIG_NSC_GPIO is not set
CONFIG_DEVMEM=y
CONFIG_RANDOM_TRUST_CPU=y
CONFIG_RANDOM_TRUST_BOOTLOADER=y
# end of Character devices

#
# I2C support
#
# CONFIG_I2C is not set
# end of I2C support

# CONFIG_I3C is not set
# CONFIG_SPMI is not set
# CONFIG_HSI is not set
CONFIG_PPS=y
# CONFIG_PPS_DEBUG is not set

#
# PPS clients support
#
# CONFIG_PPS_CLIENT_KTIMER is not set
# CONFIG_PPS_CLIENT_LDISC is not set
# CONFIG_PPS_CLIENT_GPIO is not set

#
# PPS generators support
#

#
# PTP clock support
#
CONFIG_PTP_1588_CLOCK=y
CONFIG_PTP_1588_CLOCK_OPTIONAL=y

#
# Enable PHYLIB and NETWORK_PHY_TIMESTAMPING to see the additional clocks.
#
# end of PTP clock support

# CONFIG_PINCTRL is not set
# CONFIG_GPIOLIB is not set
# CONFIG_POWER_RESET is not set
# CONFIG_POWER_SUPPLY is not set
# CONFIG_THERMAL is not set
# CONFIG_WATCHDOG is not set
# CONFIG_REGULATOR is not set
# CONFIG_RC_CORE is not set

#
# CEC support
#
# CONFIG_MEDIA_CEC_SUPPORT is not set
# end of CEC support

#
# Graphics support
#
# end of Graphics support

CONFIG_SOUND_OSS_CORE_PRECLAIM=y

#
# HID support
#
CONFIG_HID=y
# CONFIG_HID_BATTERY_STRENGTH is not set
# CONFIG_HIDRAW is not set
# CONFIG_UHID is not set
CONFIG_HID_GENERIC=y

#
# Special HID drivers
#
CONFIG_HID_A4TECH=y
# CONFIG_HID_ACRUX is not set
# CONFIG_HID_AUREAL is not set
CONFIG_HID_BELKIN=y
CONFIG_HID_CHERRY=y
# CONFIG_HID_COUGAR is not set
# CONFIG_HID_MACALLY is not set
# CONFIG_HID_CMEDIA is not set
CONFIG_HID_CYPRESS=y
# CONFIG_HID_DRAGONRISE is not set
# CONFIG_HID_EMS_FF is not set
# CONFIG_HID_ELECOM is not set
CONFIG_HID_EZKEY=y
# CONFIG_HID_GEMBIRD is not set
# CONFIG_HID_GFRM is not set
# CONFIG_HID_GLORIOUS is not set
# CONFIG_HID_VIVALDI is not set
# CONFIG_HID_KEYTOUCH is not set
# CONFIG_HID_KYE is not set
# CONFIG_HID_WALTOP is not set
# CONFIG_HID_VIEWSONIC is not set
# CONFIG_HID_XIAOMI is not set
# CONFIG_HID_GYRATION is not set
# CONFIG_HID_ICADE is not set
CONFIG_HID_ITE=y
# CONFIG_HID_JABRA is not set
# CONFIG_HID_TWINHAN is not set
CONFIG_HID_KENSINGTON=y
# CONFIG_HID_LCPOWER is not set
# CONFIG_HID_LENOVO is not set
# CONFIG_HID_MAGICMOUSE is not set
# CONFIG_HID_MALTRON is not set
# CONFIG_HID_MAYFLASH is not set
CONFIG_HID_REDRAGON=y
CONFIG_HID_MICROSOFT=y
CONFIG_HID_MONTEREY=y
# CONFIG_HID_MULTITOUCH is not set
# CONFIG_HID_NTI is not set
# CONFIG_HID_ORTEK is not set
# CONFIG_HID_PANTHERLORD is not set
# CONFIG_HID_PETALYNX is not set
# CONFIG_HID_PICOLCD is not set
# CONFIG_HID_PLANTRONICS is not set
# CONFIG_HID_RAZER is not set
# CONFIG_HID_PRIMAX is not set
# CONFIG_HID_SAITEK is not set
# CONFIG_HID_SEMITEK is not set
# CONFIG_HID_SPEEDLINK is not set
# CONFIG_HID_STEAM is not set
# CONFIG_HID_STEELSERIES is not set
# CONFIG_HID_SUNPLUS is not set
# CONFIG_HID_RMI is not set
# CONFIG_HID_GREENASIA is not set
# CONFIG_HID_SMARTJOYPLUS is not set
# CONFIG_HID_TIVO is not set
# CONFIG_HID_TOPSEED is not set
# CONFIG_HID_UDRAW_PS3 is not set
# CONFIG_HID_XINMO is not set
# CONFIG_HID_ZEROPLUS is not set
# CONFIG_HID_ZYDACRON is not set
# CONFIG_HID_ALPS is not set
# end of Special HID drivers
# end of HID support

CONFIG_USB_OHCI_LITTLE_ENDIAN=y
# CONFIG_MEMSTICK is not set
# CONFIG_NEW_LEDS is not set
# CONFIG_ACCESSIBILITY is not set
# CONFIG_RTC_CLASS is not set

#
# DMABUF options
#
# CONFIG_SYNC_FILE is not set
# CONFIG_DMABUF_HEAPS is not set
# end of DMABUF options

# CONFIG_AUXDISPLAY is not set
# CONFIG_UIO is not set
# CONFIG_VFIO is not set
# CONFIG_VIRT_DRIVERS is not set
CONFIG_VIRTIO_MENU=y
# CONFIG_VDPA is not set
CONFIG_VHOST_MENU=y
# CONFIG_VHOST_NET is not set
# CONFIG_VHOST_CROSS_ENDIAN_LEGACY is not set

#
# Microsoft Hyper-V guest support
#
# end of Microsoft Hyper-V guest support

# CONFIG_GREYBUS is not set
# CONFIG_COMEDI is not set
# CONFIG_STAGING is not set
# CONFIG_COMMON_CLK is not set
# CONFIG_HWSPINLOCK is not set

#
# Clock Source drivers
#
# end of Clock Source drivers

# CONFIG_MAILBOX is not set
CONFIG_IOMMU_SUPPORT=y

#
# Generic IOMMU Pagetable Support
#
# end of Generic IOMMU Pagetable Support

#
# Remoteproc drivers
#
# end of Remoteproc drivers

#
# Rpmsg drivers
#
# end of Rpmsg drivers

#
# SOC (System On Chip) specific Drivers
#

#
# Amlogic SoC drivers
#
# end of Amlogic SoC drivers

#
# Broadcom SoC drivers
#
# end of Broadcom SoC drivers

#
# NXP/Freescale QorIQ SoC drivers
#
# end of NXP/Freescale QorIQ SoC drivers

#
# fujitsu SoC drivers
#
# end of fujitsu SoC drivers

#
# i.MX SoC drivers
#
# end of i.MX SoC drivers

#
# Enable LiteX SoC Builder specific drivers
#
# end of Enable LiteX SoC Builder specific drivers

#
# Qualcomm SoC drivers
#
# end of Qualcomm SoC drivers

# CONFIG_SOC_TI is not set

#
# Xilinx SoC drivers
#
# end of Xilinx SoC drivers
# end of SOC (System On Chip) specific Drivers

# CONFIG_PM_DEVFREQ is not set
# CONFIG_EXTCON is not set
# CONFIG_MEMORY is not set
# CONFIG_IIO is not set
# CONFIG_PWM is not set

#
# IRQ chip support
#
# end of IRQ chip support

# CONFIG_RESET_CONTROLLER is not set

#
# PHY Subsystem
#
# CONFIG_GENERIC_PHY is not set
# CONFIG_PHY_CAN_TRANSCEIVER is not set

#
# PHY drivers for Broadcom platforms
#
# end of PHY drivers for Broadcom platforms
# end of PHY Subsystem

# CONFIG_POWERCAP is not set
# CONFIG_RAS is not set

#
# Android
#
# CONFIG_ANDROID_BINDER_IPC is not set
# end of Android

# CONFIG_DAX is not set
# CONFIG_NVMEM is not set

#
# HW tracing support
#
# CONFIG_STM is not set
# end of HW tracing support

# CONFIG_FPGA is not set
# CONFIG_TEE is not set
# CONFIG_SIOX is not set
# CONFIG_SLIMBUS is not set
# CONFIG_INTERCONNECT is not set
# CONFIG_COUNTER is not set
# CONFIG_PECI is not set
# CONFIG_HTE is not set
# end of Device Drivers

#
# File systems
#
CONFIG_DCACHE_WORD_ACCESS=y
# CONFIG_VALIDATE_FS_PARSER is not set
CONFIG_FS_IOMAP=y
# CONFIG_EXT2_FS is not set
# CONFIG_EXT3_FS is not set
CONFIG_EXT4_FS=y
CONFIG_EXT4_USE_FOR_EXT2=y
# CONFIG_EXT4_FS_POSIX_ACL is not set
# CONFIG_EXT4_FS_SECURITY is not set
# CONFIG_EXT4_DEBUG is not set
CONFIG_JBD2=y
# CONFIG_JBD2_DEBUG is not set
CONFIG_FS_MBCACHE=y
CONFIG_REISERFS_FS=y
# CONFIG_REISERFS_CHECK is not set
# CONFIG_REISERFS_PROC_INFO is not set
# CONFIG_REISERFS_FS_XATTR is not set
# CONFIG_JFS_FS is not set
# CONFIG_XFS_FS is not set
# CONFIG_GFS2_FS is not set
# CONFIG_BTRFS_FS is not set
# CONFIG_NILFS2_FS is not set
# CONFIG_F2FS_FS is not set
CONFIG_EXPORTFS=y
# CONFIG_EXPORTFS_BLOCK_OPS is not set
CONFIG_FILE_LOCKING=y
# CONFIG_FS_ENCRYPTION is not set
# CONFIG_FS_VERITY is not set
CONFIG_FSNOTIFY=y
CONFIG_DNOTIFY=y
CONFIG_INOTIFY_USER=y
# CONFIG_FANOTIFY is not set
CONFIG_QUOTA=y
# CONFIG_QUOTA_NETLINK_INTERFACE is not set
CONFIG_PRINT_QUOTA_WARNING=y
# CONFIG_QUOTA_DEBUG is not set
# CONFIG_QFMT_V1 is not set
# CONFIG_QFMT_V2 is not set
CONFIG_QUOTACTL=y
CONFIG_AUTOFS4_FS=m
CONFIG_AUTOFS_FS=m
# CONFIG_FUSE_FS is not set
# CONFIG_OVERLAY_FS is not set

#
# Caches
#
# CONFIG_FSCACHE is not set
# end of Caches

#
# CD-ROM/DVD Filesystems
#
CONFIG_ISO9660_FS=m
CONFIG_JOLIET=y
# CONFIG_ZISOFS is not set
# CONFIG_UDF_FS is not set
# end of CD-ROM/DVD Filesystems

#
# DOS/FAT/EXFAT/NT Filesystems
#
# CONFIG_MSDOS_FS is not set
# CONFIG_VFAT_FS is not set
# CONFIG_EXFAT_FS is not set
# CONFIG_NTFS_FS is not set
# CONFIG_NTFS3_FS is not set
# end of DOS/FAT/EXFAT/NT Filesystems

#
# Pseudo filesystems
#
CONFIG_PROC_FS=y
CONFIG_PROC_KCORE=y
CONFIG_PROC_SYSCTL=y
CONFIG_PROC_PAGE_MONITOR=y
# CONFIG_PROC_CHILDREN is not set
CONFIG_KERNFS=y
CONFIG_SYSFS=y
CONFIG_TMPFS=y
# CONFIG_TMPFS_POSIX_ACL is not set
# CONFIG_TMPFS_XATTR is not set
CONFIG_MEMFD_CREATE=y
# CONFIG_CONFIGFS_FS is not set
# end of Pseudo filesystems

CONFIG_MISC_FILESYSTEMS=y
# CONFIG_ORANGEFS_FS is not set
# CONFIG_ADFS_FS is not set
# CONFIG_AFFS_FS is not set
# CONFIG_HFS_FS is not set
# CONFIG_HFSPLUS_FS is not set
# CONFIG_BEFS_FS is not set
# CONFIG_BFS_FS is not set
# CONFIG_EFS_FS is not set
# CONFIG_CRAMFS is not set
# CONFIG_SQUASHFS is not set
# CONFIG_VXFS_FS is not set
# CONFIG_MINIX_FS is not set
# CONFIG_OMFS_FS is not set
# CONFIG_HPFS_FS is not set
# CONFIG_QNX4FS_FS is not set
# CONFIG_QNX6FS_FS is not set
# CONFIG_ROMFS_FS is not set
# CONFIG_PSTORE is not set
# CONFIG_SYSV_FS is not set
# CONFIG_UFS_FS is not set
# CONFIG_EROFS_FS is not set
CONFIG_NETWORK_FILESYSTEMS=y
# CONFIG_NFS_FS is not set
# CONFIG_NFSD is not set
# CONFIG_CEPH_FS is not set
# CONFIG_CIFS is not set
# CONFIG_SMB_SERVER is not set
# CONFIG_CODA_FS is not set
# CONFIG_AFS_FS is not set
CONFIG_NLS=y
CONFIG_NLS_DEFAULT="iso8859-1"
# CONFIG_NLS_CODEPAGE_437 is not set
# CONFIG_NLS_CODEPAGE_737 is not set
# CONFIG_NLS_CODEPAGE_775 is not set
# CONFIG_NLS_CODEPAGE_850 is not set
# CONFIG_NLS_CODEPAGE_852 is not set
# CONFIG_NLS_CODEPAGE_855 is not set
# CONFIG_NLS_CODEPAGE_857 is not set
# CONFIG_NLS_CODEPAGE_860 is not set
# CONFIG_NLS_CODEPAGE_861 is not set
# CONFIG_NLS_CODEPAGE_862 is not set
# CONFIG_NLS_CODEPAGE_863 is not set
# CONFIG_NLS_CODEPAGE_864 is not set
# CONFIG_NLS_CODEPAGE_865 is not set
# CONFIG_NLS_CODEPAGE_866 is not set
# CONFIG_NLS_CODEPAGE_869 is not set
# CONFIG_NLS_CODEPAGE_936 is not set
# CONFIG_NLS_CODEPAGE_950 is not set
# CONFIG_NLS_CODEPAGE_932 is not set
# CONFIG_NLS_CODEPAGE_949 is not set
# CONFIG_NLS_CODEPAGE_874 is not set
# CONFIG_NLS_ISO8859_8 is not set
# CONFIG_NLS_CODEPAGE_1250 is not set
# CONFIG_NLS_CODEPAGE_1251 is not set
# CONFIG_NLS_ASCII is not set
# CONFIG_NLS_ISO8859_1 is not set
# CONFIG_NLS_ISO8859_2 is not set
# CONFIG_NLS_ISO8859_3 is not set
# CONFIG_NLS_ISO8859_4 is not set
# CONFIG_NLS_ISO8859_5 is not set
# CONFIG_NLS_ISO8859_6 is not set
# CONFIG_NLS_ISO8859_7 is not set
# CONFIG_NLS_ISO8859_9 is not set
# CONFIG_NLS_ISO8859_13 is not set
# CONFIG_NLS_ISO8859_14 is not set
# CONFIG_NLS_ISO8859_15 is not set
# CONFIG_NLS_KOI8_R is not set
# CONFIG_NLS_KOI8_U is not set
# CONFIG_NLS_MAC_ROMAN is not set
# CONFIG_NLS_MAC_CELTIC is not set
# CONFIG_NLS_MAC_CENTEURO is not set
# CONFIG_NLS_MAC_CROATIAN is not set
# CONFIG_NLS_MAC_CYRILLIC is not set
# CONFIG_NLS_MAC_GAELIC is not set
# CONFIG_NLS_MAC_GREEK is not set
# CONFIG_NLS_MAC_ICELAND is not set
# CONFIG_NLS_MAC_INUIT is not set
# CONFIG_NLS_MAC_ROMANIAN is not set
# CONFIG_NLS_MAC_TURKISH is not set
# CONFIG_NLS_UTF8 is not set
# CONFIG_UNICODE is not set
CONFIG_IO_WQ=y
# end of File systems

#
# Security options
#
# CONFIG_KEYS is not set
# CONFIG_SECURITY_DMESG_RESTRICT is not set
# CONFIG_SECURITY is not set
# CONFIG_SECURITYFS is not set
CONFIG_HAVE_HARDENED_USERCOPY_ALLOCATOR=y
# CONFIG_HARDENED_USERCOPY is not set
# CONFIG_STATIC_USERMODEHELPER is not set
CONFIG_DEFAULT_SECURITY_DAC=y
CONFIG_LSM="landlock,lockdown,yama,loadpin,safesetid,integrity,bpf"

#
# Kernel hardening options
#

#
# Memory initialization
#
CONFIG_INIT_STACK_NONE=y
# CONFIG_GCC_PLUGIN_STRUCTLEAK_USER is not set
# CONFIG_GCC_PLUGIN_STRUCTLEAK_BYREF is not set
# CONFIG_GCC_PLUGIN_STRUCTLEAK_BYREF_ALL is not set
# CONFIG_INIT_ON_ALLOC_DEFAULT_ON is not set
# CONFIG_INIT_ON_FREE_DEFAULT_ON is not set
CONFIG_CC_HAS_ZERO_CALL_USED_REGS=y
# CONFIG_ZERO_CALL_USED_REGS is not set
# end of Memory initialization

CONFIG_RANDSTRUCT_NONE=y
# CONFIG_RANDSTRUCT_FULL is not set
# CONFIG_RANDSTRUCT_PERFORMANCE is not set
# end of Kernel hardening options
# end of Security options

CONFIG_CRYPTO=y

#
# Crypto core or helper
#
CONFIG_CRYPTO_ALGAPI=y
CONFIG_CRYPTO_ALGAPI2=y
CONFIG_CRYPTO_HASH=y
CONFIG_CRYPTO_HASH2=y
# CONFIG_CRYPTO_MANAGER is not set
# CONFIG_CRYPTO_USER is not set
CONFIG_CRYPTO_MANAGER_DISABLE_TESTS=y
# CONFIG_CRYPTO_NULL is not set
# CONFIG_CRYPTO_CRYPTD is not set
# CONFIG_CRYPTO_AUTHENC is not set
# CONFIG_CRYPTO_TEST is not set

#
# Public-key cryptography
#
# CONFIG_CRYPTO_RSA is not set
# CONFIG_CRYPTO_DH is not set
# CONFIG_CRYPTO_ECDH is not set
# CONFIG_CRYPTO_ECDSA is not set
# CONFIG_CRYPTO_ECRDSA is not set
# CONFIG_CRYPTO_SM2 is not set
# CONFIG_CRYPTO_CURVE25519 is not set

#
# Authenticated Encryption with Associated Data
#
# CONFIG_CRYPTO_CCM is not set
# CONFIG_CRYPTO_GCM is not set
# CONFIG_CRYPTO_CHACHA20POLY1305 is not set
# CONFIG_CRYPTO_AEGIS128 is not set
# CONFIG_CRYPTO_SEQIV is not set
# CONFIG_CRYPTO_ECHAINIV is not set

#
# Block modes
#
# CONFIG_CRYPTO_CBC is not set
# CONFIG_CRYPTO_CFB is not set
# CONFIG_CRYPTO_CTR is not set
# CONFIG_CRYPTO_CTS is not set
# CONFIG_CRYPTO_ECB is not set
# CONFIG_CRYPTO_LRW is not set
# CONFIG_CRYPTO_OFB is not set
# CONFIG_CRYPTO_PCBC is not set
# CONFIG_CRYPTO_XTS is not set
# CONFIG_CRYPTO_KEYWRAP is not set
# CONFIG_CRYPTO_ADIANTUM is not set
# CONFIG_CRYPTO_HCTR2 is not set
# CONFIG_CRYPTO_ESSIV is not set

#
# Hash modes
#
# CONFIG_CRYPTO_CMAC is not set
# CONFIG_CRYPTO_HMAC is not set
# CONFIG_CRYPTO_XCBC is not set
# CONFIG_CRYPTO_VMAC is not set

#
# Digest
#
CONFIG_CRYPTO_CRC32C=y
# CONFIG_CRYPTO_CRC32 is not set
# CONFIG_CRYPTO_XXHASH is not set
# CONFIG_CRYPTO_BLAKE2B is not set
# CONFIG_CRYPTO_CRCT10DIF is not set
# CONFIG_CRYPTO_GHASH is not set
# CONFIG_CRYPTO_POLY1305 is not set
# CONFIG_CRYPTO_MD4 is not set
# CONFIG_CRYPTO_MD5 is not set
# CONFIG_CRYPTO_MICHAEL_MIC is not set
# CONFIG_CRYPTO_RMD160 is not set
# CONFIG_CRYPTO_SHA1 is not set
# CONFIG_CRYPTO_SHA256 is not set
# CONFIG_CRYPTO_SHA512 is not set
# CONFIG_CRYPTO_SHA3 is not set
# CONFIG_CRYPTO_SM3_GENERIC is not set
# CONFIG_CRYPTO_STREEBOG is not set
# CONFIG_CRYPTO_WP512 is not set

#
# Ciphers
#
# CONFIG_CRYPTO_AES is not set
# CONFIG_CRYPTO_AES_TI is not set
# CONFIG_CRYPTO_BLOWFISH is not set
# CONFIG_CRYPTO_CAMELLIA is not set
# CONFIG_CRYPTO_CAST5 is not set
# CONFIG_CRYPTO_CAST6 is not set
# CONFIG_CRYPTO_DES is not set
# CONFIG_CRYPTO_FCRYPT is not set
# CONFIG_CRYPTO_CHACHA20 is not set
# CONFIG_CRYPTO_ARIA is not set
# CONFIG_CRYPTO_SERPENT is not set
# CONFIG_CRYPTO_SM4_GENERIC is not set
# CONFIG_CRYPTO_TWOFISH is not set
# CONFIG_CRYPTO_TWOFISH_586 is not set

#
# Compression
#
# CONFIG_CRYPTO_DEFLATE is not set
# CONFIG_CRYPTO_LZO is not set
# CONFIG_CRYPTO_842 is not set
# CONFIG_CRYPTO_LZ4 is not set
# CONFIG_CRYPTO_LZ4HC is not set
# CONFIG_CRYPTO_ZSTD is not set

#
# Random Number Generation
#
# CONFIG_CRYPTO_ANSI_CPRNG is not set
# CONFIG_CRYPTO_DRBG_MENU is not set
# CONFIG_CRYPTO_JITTERENTROPY is not set
# CONFIG_CRYPTO_USER_API_HASH is not set
# CONFIG_CRYPTO_USER_API_SKCIPHER is not set
# CONFIG_CRYPTO_USER_API_RNG is not set
# CONFIG_CRYPTO_USER_API_AEAD is not set
CONFIG_CRYPTO_HW=y

#
# Certificates for signature checking
#
# end of Certificates for signature checking

#
# Library routines
#
# CONFIG_PACKING is not set
CONFIG_BITREVERSE=y
CONFIG_ARCH_HAS_STRNCPY_FROM_USER=y
CONFIG_ARCH_HAS_STRNLEN_USER=y
CONFIG_GENERIC_NET_UTILS=y
# CONFIG_CORDIC is not set
# CONFIG_PRIME_NUMBERS is not set

#
# Crypto library routines
#
CONFIG_CRYPTO_LIB_BLAKE2S_GENERIC=y
# CONFIG_CRYPTO_LIB_CHACHA is not set
# CONFIG_CRYPTO_LIB_CURVE25519 is not set
CONFIG_CRYPTO_LIB_POLY1305_RSIZE=1
# CONFIG_CRYPTO_LIB_POLY1305 is not set
# CONFIG_CRYPTO_LIB_CHACHA20POLY1305 is not set
CONFIG_CRYPTO_LIB_SHA1=y
# end of Crypto library routines

CONFIG_LIB_MEMNEQ=y
# CONFIG_CRC_CCITT is not set
CONFIG_CRC16=y
# CONFIG_CRC_T10DIF is not set
# CONFIG_CRC64_ROCKSOFT is not set
# CONFIG_CRC_ITU_T is not set
CONFIG_CRC32=y
# CONFIG_CRC32_SELFTEST is not set
CONFIG_CRC32_SLICEBY8=y
# CONFIG_CRC32_SLICEBY4 is not set
# CONFIG_CRC32_SARWATE is not set
# CONFIG_CRC32_BIT is not set
# CONFIG_CRC64 is not set
# CONFIG_CRC4 is not set
# CONFIG_CRC7 is not set
# CONFIG_LIBCRC32C is not set
# CONFIG_CRC8 is not set
# CONFIG_RANDOM32_SELFTEST is not set
# CONFIG_XZ_DEC is not set
CONFIG_NO_DMA=y
# CONFIG_DMA_API_DEBUG is not set
CONFIG_DQL=y
CONFIG_NLATTR=y
# CONFIG_IRQ_POLL is not set
CONFIG_SBITMAP=y
# end of Library routines

#
# Kernel hacking
#

#
# printk and dmesg options
#
# CONFIG_PRINTK_TIME is not set
# CONFIG_PRINTK_CALLER is not set
# CONFIG_STACKTRACE_BUILD_ID is not set
CONFIG_CONSOLE_LOGLEVEL_DEFAULT=7
CONFIG_CONSOLE_LOGLEVEL_QUIET=4
CONFIG_MESSAGE_LOGLEVEL_DEFAULT=4
# CONFIG_BOOT_PRINTK_DELAY is not set
# CONFIG_DYNAMIC_DEBUG is not set
# CONFIG_DYNAMIC_DEBUG_CORE is not set
CONFIG_SYMBOLIC_ERRNAME=y
CONFIG_DEBUG_BUGVERBOSE=y
# end of printk and dmesg options

CONFIG_DEBUG_KERNEL=y
CONFIG_DEBUG_MISC=y

#
# Compile-time checks and compiler options
#
CONFIG_DEBUG_INFO_NONE=y
# CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT is not set
# CONFIG_DEBUG_INFO_DWARF4 is not set
# CONFIG_DEBUG_INFO_DWARF5 is not set
CONFIG_FRAME_WARN=1024
# CONFIG_STRIP_ASM_SYMS is not set
# CONFIG_READABLE_ASM is not set
CONFIG_DEBUG_SECTION_MISMATCH=y
CONFIG_SECTION_MISMATCH_WARN_ONLY=y
# CONFIG_FRAME_POINTER is not set
# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set
# end of Compile-time checks and compiler options

#
# Generic Kernel Debugging Instruments
#
CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE=0x1
CONFIG_MAGIC_SYSRQ_SERIAL=y
CONFIG_MAGIC_SYSRQ_SERIAL_SEQUENCE=""
# CONFIG_DEBUG_FS is not set
# CONFIG_UBSAN is not set
CONFIG_HAVE_KCSAN_COMPILER=y
# end of Generic Kernel Debugging Instruments

#
# Networking Debugging
#
# CONFIG_NET_DEV_REFCNT_TRACKER is not set
# CONFIG_NET_NS_REFCNT_TRACKER is not set
# CONFIG_DEBUG_NET is not set
# end of Networking Debugging

#
# Memory Debugging
#
# CONFIG_PAGE_EXTENSION is not set
# CONFIG_DEBUG_PAGEALLOC is not set
# CONFIG_DEBUG_SLAB is not set
# CONFIG_PAGE_OWNER is not set
# CONFIG_PAGE_POISONING is not set
# CONFIG_DEBUG_OBJECTS is not set
CONFIG_HAVE_DEBUG_KMEMLEAK=y
# CONFIG_DEBUG_KMEMLEAK is not set
# CONFIG_DEBUG_STACK_USAGE is not set
# CONFIG_SCHED_STACK_END_CHECK is not set
# CONFIG_DEBUG_VM is not set
CONFIG_DEBUG_MEMORY_INIT=y
CONFIG_CC_HAS_KASAN_GENERIC=y
CONFIG_CC_HAS_WORKING_NOSANITIZE_ADDRESS=y
# end of Memory Debugging

# CONFIG_DEBUG_SHIRQ is not set

#
# Debug Oops, Lockups and Hangs
#
# CONFIG_PANIC_ON_OOPS is not set
CONFIG_PANIC_ON_OOPS_VALUE=0
CONFIG_PANIC_TIMEOUT=0
# CONFIG_SOFTLOCKUP_DETECTOR is not set
# CONFIG_DETECT_HUNG_TASK is not set
# CONFIG_WQ_WATCHDOG is not set
# CONFIG_TEST_LOCKUP is not set
# end of Debug Oops, Lockups and Hangs

#
# Scheduler Debugging
#
CONFIG_SCHED_DEBUG=y
# CONFIG_SCHEDSTATS is not set
# end of Scheduler Debugging

# CONFIG_DEBUG_TIMEKEEPING is not set

#
# Lock Debugging (spinlocks, mutexes, etc...)
#
CONFIG_LOCK_DEBUGGING_SUPPORT=y
# CONFIG_PROVE_LOCKING is not set
# CONFIG_LOCK_STAT is not set
# CONFIG_DEBUG_RT_MUTEXES is not set
# CONFIG_DEBUG_SPINLOCK is not set
# CONFIG_DEBUG_MUTEXES is not set
# CONFIG_DEBUG_WW_MUTEX_SLOWPATH is not set
# CONFIG_DEBUG_RWSEMS is not set
# CONFIG_DEBUG_LOCK_ALLOC is not set
# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
# CONFIG_LOCK_TORTURE_TEST is not set
# CONFIG_WW_MUTEX_SELFTEST is not set
# CONFIG_SCF_TORTURE_TEST is not set
# end of Lock Debugging (spinlocks, mutexes, etc...)

# CONFIG_DEBUG_IRQFLAGS is not set
CONFIG_STACKTRACE=y
# CONFIG_WARN_ALL_UNSEEDED_RANDOM is not set
# CONFIG_DEBUG_KOBJECT is not set
CONFIG_HAVE_DEBUG_BUGVERBOSE=y

#
# Debug kernel data structures
#
# CONFIG_DEBUG_LIST is not set
# CONFIG_DEBUG_PLIST is not set
# CONFIG_DEBUG_SG is not set
# CONFIG_DEBUG_NOTIFIERS is not set
# CONFIG_BUG_ON_DATA_CORRUPTION is not set
# end of Debug kernel data structures

# CONFIG_DEBUG_CREDENTIALS is not set

#
# RCU Debugging
#
# CONFIG_RCU_SCALE_TEST is not set
# CONFIG_RCU_TORTURE_TEST is not set
# CONFIG_RCU_REF_SCALE_TEST is not set
# CONFIG_RCU_TRACE is not set
# CONFIG_RCU_EQS_DEBUG is not set
# end of RCU Debugging

# CONFIG_DEBUG_WQ_FORCE_RR_CPU is not set
CONFIG_TRACING_SUPPORT=y
CONFIG_FTRACE=y
# CONFIG_IRQSOFF_TRACER is not set
# CONFIG_SCHED_TRACER is not set
# CONFIG_HWLAT_TRACER is not set
# CONFIG_OSNOISE_TRACER is not set
# CONFIG_TIMERLAT_TRACER is not set
# CONFIG_ENABLE_DEFAULT_TRACERS is not set
# CONFIG_TRACER_SNAPSHOT is not set
CONFIG_BRANCH_PROFILE_NONE=y
# CONFIG_PROFILE_ANNOTATED_BRANCHES is not set
# CONFIG_PROFILE_ALL_BRANCHES is not set
# CONFIG_BLK_DEV_IO_TRACE is not set
# CONFIG_SYNTH_EVENTS is not set
# CONFIG_TRACEPOINT_BENCHMARK is not set
# CONFIG_PREEMPTIRQ_DELAY_TEST is not set
# CONFIG_SAMPLES is not set

#
# um Debugging
#
CONFIG_EARLY_PRINTK=y
# end of um Debugging

#
# Kernel Testing and Coverage
#
# CONFIG_KUNIT is not set
# CONFIG_NOTIFIER_ERROR_INJECTION is not set
# CONFIG_FAULT_INJECTION is not set
CONFIG_ARCH_HAS_KCOV=y
CONFIG_CC_HAS_SANCOV_TRACE_PC=y
# CONFIG_KCOV is not set
CONFIG_RUNTIME_TESTING_MENU=y
# CONFIG_TEST_MIN_HEAP is not set
# CONFIG_TEST_DIV64 is not set
# CONFIG_BACKTRACE_SELF_TEST is not set
# CONFIG_TEST_REF_TRACKER is not set
# CONFIG_RBTREE_TEST is not set
# CONFIG_REED_SOLOMON_TEST is not set
# CONFIG_INTERVAL_TREE_TEST is not set
# CONFIG_PERCPU_TEST is not set
# CONFIG_ATOMIC64_SELFTEST is not set
# CONFIG_TEST_HEXDUMP is not set
# CONFIG_STRING_SELFTEST is not set
# CONFIG_TEST_STRING_HELPERS is not set
# CONFIG_TEST_STRSCPY is not set
# CONFIG_TEST_KSTRTOX is not set
# CONFIG_TEST_PRINTF is not set
# CONFIG_TEST_SCANF is not set
# CONFIG_TEST_BITMAP is not set
# CONFIG_TEST_UUID is not set
# CONFIG_TEST_XARRAY is not set
# CONFIG_TEST_RHASHTABLE is not set
# CONFIG_TEST_SIPHASH is not set
# CONFIG_TEST_IDA is not set
# CONFIG_TEST_LKM is not set
# CONFIG_TEST_BITOPS is not set
# CONFIG_TEST_VMALLOC is not set
# CONFIG_TEST_USER_COPY is not set
# CONFIG_TEST_BPF is not set
# CONFIG_TEST_BLACKHOLE_DEV is not set
# CONFIG_FIND_BIT_BENCHMARK is not set
# CONFIG_TEST_FIRMWARE is not set
# CONFIG_TEST_SYSCTL is not set
# CONFIG_TEST_UDELAY is not set
# CONFIG_TEST_STATIC_KEYS is not set
# CONFIG_TEST_KMOD is not set
# CONFIG_TEST_MEMCAT_P is not set
# CONFIG_TEST_MEMINIT is not set
# CONFIG_TEST_FREE_PAGES is not set
# end of Kernel Testing and Coverage
# end of Kernel hacking

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [PATCH 8/8] mm/slub, percpu: correct the calculation of early percpu allocation size
  2022-10-24  8:14 ` [PATCH 8/8] mm/slub, percpu: correct the calculation of early percpu allocation size Baoquan He
@ 2022-10-24 13:52   ` Hyeonggon Yoo
  2022-10-24 17:03   ` Dennis Zhou
  2022-11-06 20:56   ` Vlastimil Babka
  2 siblings, 0 replies; 29+ messages in thread
From: Hyeonggon Yoo @ 2022-10-24 13:52 UTC (permalink / raw)
  To: Baoquan He
  Cc: linux-kernel, Dennis Zhou, Tejun Heo, Christoph Lameter,
	Andrew Morton, linux-mm, Pekka Enberg, David Rientjes,
	Joonsoo Kim, Vlastimil Babka, Roman Gushchin

On Mon, Oct 24, 2022 at 04:14:35PM +0800, Baoquan He wrote:
> SLUB allocator relies on percpu allocator to initialize its ->cpu_slab
> during early boot. For that, the dynamic chunk of percpu which serves
> the early allocation need be large enough to satisfy the kmalloc
> creation.
> 
> However, the current BUILD_BUG_ON() in alloc_kmem_cache_cpus() doesn't
> consider the kmalloc array with NR_KMALLOC_TYPES length. Fix that
> with correct calculation.
> 
> Signed-off-by: Baoquan He <bhe@redhat.com>
> Cc: Christoph Lameter <cl@linux.com>
> Cc: Pekka Enberg <penberg@kernel.org>
> Cc: David Rientjes <rientjes@google.com>
> Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Vlastimil Babka <vbabka@suse.cz>
> Cc: Roman Gushchin <roman.gushchin@linux.dev>
> Cc: Hyeonggon Yoo <42.hyeyoo@gmail.com>
> ---
>  mm/slub.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/mm/slub.c b/mm/slub.c
> index 157527d7101b..8ac3bb9a122a 100644
> --- a/mm/slub.c
> +++ b/mm/slub.c
> @@ -4017,7 +4017,8 @@ init_kmem_cache_node(struct kmem_cache_node *n)
>  static inline int alloc_kmem_cache_cpus(struct kmem_cache *s)
>  {
>  	BUILD_BUG_ON(PERCPU_DYNAMIC_EARLY_SIZE <
> -			KMALLOC_SHIFT_HIGH * sizeof(struct kmem_cache_cpu));
> +			NR_KMALLOC_TYPES * KMALLOC_SHIFT_HIGH *
> +			sizeof(struct kmem_cache_cpu));
>  
>  	/*
>  	 * Must align to double word boundary for the double cmpxchg

Looks good to me.

Acked-by: Hyeonggon Yoo <42.hyeyoo@gmail.com>

Thanks!

> -- 
> 2.34.1
> 

-- 
Thanks,
Hyeonggon


^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [PATCH 1/8] mm/percpu: remove unused pcpu_map_extend_chunks
  2022-10-24  8:14 ` [PATCH 1/8] mm/percpu: remove unused pcpu_map_extend_chunks Baoquan He
@ 2022-10-24 16:51   ` Dennis Zhou
  0 siblings, 0 replies; 29+ messages in thread
From: Dennis Zhou @ 2022-10-24 16:51 UTC (permalink / raw)
  To: Baoquan He
  Cc: linux-kernel, Tejun Heo, Christoph Lameter, Andrew Morton, linux-mm

On Mon, Oct 24, 2022 at 04:14:28PM +0800, Baoquan He wrote:
> Since commit 40064aeca35c ("percpu: replace area map allocator with
> bitmap"), it is unneeded.
> 
> Signed-off-by: Baoquan He <bhe@redhat.com>
> ---
>  mm/percpu.c | 3 ---
>  1 file changed, 3 deletions(-)
> 
> diff --git a/mm/percpu.c b/mm/percpu.c
> index 27697b2429c2..26d8cd2ca323 100644
> --- a/mm/percpu.c
> +++ b/mm/percpu.c
> @@ -174,9 +174,6 @@ static DEFINE_MUTEX(pcpu_alloc_mutex);	/* chunk create/destroy, [de]pop, map ext
>  
>  struct list_head *pcpu_chunk_lists __ro_after_init; /* chunk list slots */
>  
> -/* chunks which need their map areas extended, protected by pcpu_lock */
> -static LIST_HEAD(pcpu_map_extend_chunks);
> -
>  /*
>   * The number of empty populated pages, protected by pcpu_lock.
>   * The reserved chunk doesn't contribute to the count.
> -- 
> 2.34.1
> 
> 

Acked-by: Dennis Zhou <dennis@kernel.org>

Thanks,
Dennis


^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [PATCH 2/8] mm/percpu: use list_first_entry_or_null in pcpu_reclaim_populated()
  2022-10-24  8:14 ` [PATCH 2/8] mm/percpu: use list_first_entry_or_null in pcpu_reclaim_populated() Baoquan He
  2022-10-24 10:17   ` kernel test robot
@ 2022-10-24 16:52   ` Dennis Zhou
  2022-10-25  3:11   ` [PATCH v2 " Baoquan He
  2 siblings, 0 replies; 29+ messages in thread
From: Dennis Zhou @ 2022-10-24 16:52 UTC (permalink / raw)
  To: Baoquan He
  Cc: linux-kernel, Tejun Heo, Christoph Lameter, Andrew Morton, linux-mm

On Mon, Oct 24, 2022 at 04:14:29PM +0800, Baoquan He wrote:
> To replace list_empty()/list_first_entry() pair to simplify code.
> 
> Signed-off-by: Baoquan He <bhe@redhat.com>
> ---
>  mm/percpu.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/mm/percpu.c b/mm/percpu.c
> index 26d8cd2ca323..a3fde4ac03a4 100644
> --- a/mm/percpu.c
> +++ b/mm/percpu.c
> @@ -2143,9 +2143,9 @@ static void pcpu_reclaim_populated(void)
>  	 * other accessor is the free path which only returns area back to the
>  	 * allocator not touching the populated bitmap.
>  	 */
> -	while (!list_empty(&pcpu_chunk_lists[pcpu_to_depopulate_slot])) {
> -		chunk = list_first_entry(&pcpu_chunk_lists[pcpu_to_depopulate_slot],
> -					 struct pcpu_chunk, list);
> +	while (chunk = list_first_entry_or_null(
> +			&pcpu_chunk_lists[pcpu_to_depopulate_slot],
> +			struct pcpu_chunk, list)) {
>  		WARN_ON(chunk->immutable);
>  
>  		/*
> -- 
> 2.34.1
> 

With added parenthesis,

Acked-by: Dennis Zhou <dennis@kernel.org>

Thanks,
Dennis


^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [PATCH 3/8] mm/percpu: Update the code comment when creating new chunk
  2022-10-24  8:14 ` [PATCH 3/8] mm/percpu: Update the code comment when creating new chunk Baoquan He
@ 2022-10-24 16:54   ` Dennis Zhou
  0 siblings, 0 replies; 29+ messages in thread
From: Dennis Zhou @ 2022-10-24 16:54 UTC (permalink / raw)
  To: Baoquan He
  Cc: linux-kernel, Tejun Heo, Christoph Lameter, Andrew Morton, linux-mm

On Mon, Oct 24, 2022 at 04:14:30PM +0800, Baoquan He wrote:
> The lock pcpu_alloc_mutex taking code has been moved to the beginning of
> pcpu_allo() if it's non atomic allocation. So the code comment above

Typo here ^ pcpu_alloc().

> above pcpu_create_chunk() callsite need be updated.
> 
> Signed-off-by: Baoquan He <bhe@redhat.com>
> ---
>  mm/percpu.c | 6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)
> 
> diff --git a/mm/percpu.c b/mm/percpu.c
> index a3fde4ac03a4..a8121302a79c 100644
> --- a/mm/percpu.c
> +++ b/mm/percpu.c
> @@ -1817,16 +1817,12 @@ static void __percpu *pcpu_alloc(size_t size, size_t align, bool reserved,
>  
>  	spin_unlock_irqrestore(&pcpu_lock, flags);
>  
> -	/*
> -	 * No space left.  Create a new chunk.  We don't want multiple
> -	 * tasks to create chunks simultaneously.  Serialize and create iff
> -	 * there's still no empty chunk after grabbing the mutex.
> -	 */
>  	if (is_atomic) {
>  		err = "atomic alloc failed, no space left";
>  		goto fail;
>  	}
>  
> +	/* No space left.  Create a new chunk. */
>  	if (list_empty(&pcpu_chunk_lists[pcpu_free_slot])) {
>  		chunk = pcpu_create_chunk(pcpu_gfp);
>  		if (!chunk) {
> -- 
> 2.34.1
> 
> 

Acked-by: Dennis Zhou <dennis@kernel.org>

Thanks,
Dennis


^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [PATCH 4/8] mm/percpu: add comment to state the empty populated pages accounting
  2022-10-24  8:14 ` [PATCH 4/8] mm/percpu: add comment to state the empty populated pages accounting Baoquan He
@ 2022-10-24 16:56   ` Dennis Zhou
  2022-10-25  3:47     ` Baoquan He
  2022-10-25  3:45   ` [PATCH v2 " Baoquan He
  1 sibling, 1 reply; 29+ messages in thread
From: Dennis Zhou @ 2022-10-24 16:56 UTC (permalink / raw)
  To: Baoquan He
  Cc: linux-kernel, Tejun Heo, Christoph Lameter, Andrew Morton, linux-mm

On Mon, Oct 24, 2022 at 04:14:31PM +0800, Baoquan He wrote:
> When allocating an area from a chunk, pcpu_block_update_hint_alloc()
> is called to update chunk metadata, including chunk's and global
> nr_empty_pop_pages. However, if the allocation is not atomic, some
> blocks may not be populated with pages yet, while we still account it
> here. The number of pages will be subtracted with pcpu_chunk_populated()
> when populating pages.
> 
> Adding code comment to make that more understandable.
> 
> Signed-off-by: Baoquan He <bhe@redhat.com>
> ---
>  mm/percpu.c | 14 +++++++++++---
>  1 file changed, 11 insertions(+), 3 deletions(-)
> 
> diff --git a/mm/percpu.c b/mm/percpu.c
> index a8121302a79c..09e407338573 100644
> --- a/mm/percpu.c
> +++ b/mm/percpu.c
> @@ -831,13 +831,15 @@ static void pcpu_block_update_hint_alloc(struct pcpu_chunk *chunk, int bit_off,
>  
>  	/*
>  	 * Update s_block.
> -	 * block->first_free must be updated if the allocation takes its place.
> -	 * If the allocation breaks the contig_hint, a scan is required to
> -	 * restore this hint.
>  	 */
>  	if (s_block->contig_hint == PCPU_BITMAP_BLOCK_BITS)
>  		nr_empty_pages++;
>  
> +	/*
> +	 * block->first_free must be updated if the allocation takes its place.
> +	 * If the allocation breaks the contig_hint, a scan is required to
> +	 * restore this hint.
> +	 */
>  	if (s_off == s_block->first_free)
>  		s_block->first_free = find_next_zero_bit(
>  					pcpu_index_alloc_map(chunk, s_index),
> @@ -912,6 +914,12 @@ static void pcpu_block_update_hint_alloc(struct pcpu_chunk *chunk, int bit_off,
>  		}
>  	}
>  
> +	/*
> +	 * If the allocation is not atomic, some blocks may not
> +	 * be populated with pages, while we account it here.
> +	 * The number of pages will be subtracted with
> +	 * pcpu_chunk_populated() when populating pages.
> +	 */
>  	if (nr_empty_pages)
>  		pcpu_update_empty_pages(chunk, -nr_empty_pages);
>  
> -- 
> 2.34.1
> 

Heh, that's a little more subtle than I remember it being.

Acked-by: Dennis Zhou <dennis@kernel.org>

Thanks,
Dennis


^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [PATCH 5/8] mm/percpu: replace the goto with break
  2022-10-24  8:14 ` [PATCH 5/8] mm/percpu: replace the goto with break Baoquan He
@ 2022-10-24 17:00   ` Dennis Zhou
  0 siblings, 0 replies; 29+ messages in thread
From: Dennis Zhou @ 2022-10-24 17:00 UTC (permalink / raw)
  To: Baoquan He
  Cc: linux-kernel, Tejun Heo, Christoph Lameter, Andrew Morton, linux-mm

On Mon, Oct 24, 2022 at 04:14:32PM +0800, Baoquan He wrote:
> In function pcpu_reclaim_populated(), the line of goto jumping is
> unnecessary since the label 'end_chunk' is near the end of the for
> loop, use break instead.
> 
> Signed-off-by: Baoquan He <bhe@redhat.com>
> ---
>  mm/percpu.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/mm/percpu.c b/mm/percpu.c
> index 09e407338573..954abf916c7d 100644
> --- a/mm/percpu.c
> +++ b/mm/percpu.c
> @@ -2167,7 +2167,7 @@ static void pcpu_reclaim_populated(void)
>  			/* reintegrate chunk to prevent atomic alloc failures */
>  			if (pcpu_nr_empty_pop_pages < PCPU_EMPTY_POP_PAGES_HIGH) {
>  				reintegrate = true;
> -				goto end_chunk;
> +				break;
>  			}
>  
>  			/*
> @@ -2203,7 +2203,6 @@ static void pcpu_reclaim_populated(void)
>  			end = -1;
>  		}
>  
> -end_chunk:
>  		/* batch tlb flush per chunk to amortize cost */
>  		if (freed_page_start < freed_page_end) {
>  			spin_unlock_irq(&pcpu_lock);
> -- 
> 2.34.1
> 
> 

Acked-by: Dennis Zhou <dennis@kernel.org>

Thanks,
Dennis


^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [PATCH 6/8] mm/percpu.c: remove the lcm code since block size is fixed at page size
  2022-10-24  8:14 ` [PATCH 6/8] mm/percpu.c: remove the lcm code since block size is fixed at page size Baoquan He
@ 2022-10-24 17:00   ` Dennis Zhou
  0 siblings, 0 replies; 29+ messages in thread
From: Dennis Zhou @ 2022-10-24 17:00 UTC (permalink / raw)
  To: Baoquan He
  Cc: linux-kernel, Tejun Heo, Christoph Lameter, Andrew Morton, linux-mm

On Mon, Oct 24, 2022 at 04:14:33PM +0800, Baoquan He wrote:
> Since commit b239f7daf553 ("percpu: set PCPU_BITMAP_BLOCK_SIZE to
> PAGE_SIZE"), the PCPU_BITMAP_BLOCK_SIZE has been set to page size
> fixedly. So the lcm code in pcpu_alloc_first_chunk() doesn't make
> sense any more, clean it up.
> 
> Signed-off-by: Baoquan He <bhe@redhat.com>
> ---
>  mm/percpu.c | 12 ++----------
>  1 file changed, 2 insertions(+), 10 deletions(-)
> 
> diff --git a/mm/percpu.c b/mm/percpu.c
> index 954abf916c7d..96191f7b61ba 100644
> --- a/mm/percpu.c
> +++ b/mm/percpu.c
> @@ -72,7 +72,6 @@
>  #include <linux/cpumask.h>
>  #include <linux/memblock.h>
>  #include <linux/err.h>
> -#include <linux/lcm.h>
>  #include <linux/list.h>
>  #include <linux/log2.h>
>  #include <linux/mm.h>
> @@ -1347,7 +1346,7 @@ static struct pcpu_chunk * __init pcpu_alloc_first_chunk(unsigned long tmp_addr,
>  							 int map_size)
>  {
>  	struct pcpu_chunk *chunk;
> -	unsigned long aligned_addr, lcm_align;
> +	unsigned long aligned_addr;
>  	int start_offset, offset_bits, region_size, region_bits;
>  	size_t alloc_size;
>  
> @@ -1355,14 +1354,7 @@ static struct pcpu_chunk * __init pcpu_alloc_first_chunk(unsigned long tmp_addr,
>  	aligned_addr = tmp_addr & PAGE_MASK;
>  
>  	start_offset = tmp_addr - aligned_addr;
> -
> -	/*
> -	 * Align the end of the region with the LCM of PAGE_SIZE and
> -	 * PCPU_BITMAP_BLOCK_SIZE.  One of these constants is a multiple of
> -	 * the other.
> -	 */
> -	lcm_align = lcm(PAGE_SIZE, PCPU_BITMAP_BLOCK_SIZE);
> -	region_size = ALIGN(start_offset + map_size, lcm_align);
> +	region_size = ALIGN(start_offset + map_size, PAGE_SIZE);
>  
>  	/* allocate chunk */
>  	alloc_size = struct_size(chunk, populated,
> -- 
> 2.34.1
> 
> 

Acked-by: Dennis Zhou <dennis@kernel.org>

Thanks,
Dennis


^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [PATCH 7/8] mm/percpu: remove unused PERCPU_DYNAMIC_EARLY_SLOTS
  2022-10-24  8:14 ` [PATCH 7/8] mm/percpu: remove unused PERCPU_DYNAMIC_EARLY_SLOTS Baoquan He
@ 2022-10-24 17:03   ` Dennis Zhou
  0 siblings, 0 replies; 29+ messages in thread
From: Dennis Zhou @ 2022-10-24 17:03 UTC (permalink / raw)
  To: Baoquan He
  Cc: linux-kernel, Tejun Heo, Christoph Lameter, Andrew Morton, linux-mm

On Mon, Oct 24, 2022 at 04:14:34PM +0800, Baoquan He wrote:
> Since commit 40064aeca35c ("percpu: replace area map allocator with
> bitmap"), there's no place to use PERCPU_DYNAMIC_EARLY_SLOTS. So
> clean it up.
> 
> Signed-off-by: Baoquan He <bhe@redhat.com>
> ---
>  include/linux/percpu.h | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/include/linux/percpu.h b/include/linux/percpu.h
> index f1ec5ad1351c..70bc17db00a6 100644
> --- a/include/linux/percpu.h
> +++ b/include/linux/percpu.h
> @@ -37,11 +37,10 @@
>  /*
>   * Percpu allocator can serve percpu allocations before slab is
>   * initialized which allows slab to depend on the percpu allocator.
> - * The following two parameters decide how much resource to
> - * preallocate for this.  Keep PERCPU_DYNAMIC_RESERVE equal to or
> - * larger than PERCPU_DYNAMIC_EARLY_SIZE.
> + * The following parameter decide how much resource to preallocate
> + * for this.  Keep PERCPU_DYNAMIC_RESERVE equal to or larger than
> + * PERCPU_DYNAMIC_EARLY_SIZE.
>   */
> -#define PERCPU_DYNAMIC_EARLY_SLOTS	128
>  #define PERCPU_DYNAMIC_EARLY_SIZE	(12 << 10)
>  
>  /*
> -- 
> 2.34.1
> 

Acked-by: Dennis Zhou <dennis@kernel.org>

Thanks,
Dennis


^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [PATCH 8/8] mm/slub, percpu: correct the calculation of early percpu allocation size
  2022-10-24  8:14 ` [PATCH 8/8] mm/slub, percpu: correct the calculation of early percpu allocation size Baoquan He
  2022-10-24 13:52   ` Hyeonggon Yoo
@ 2022-10-24 17:03   ` Dennis Zhou
  2022-11-06 20:56   ` Vlastimil Babka
  2 siblings, 0 replies; 29+ messages in thread
From: Dennis Zhou @ 2022-10-24 17:03 UTC (permalink / raw)
  To: Baoquan He
  Cc: linux-kernel, Tejun Heo, Christoph Lameter, Andrew Morton,
	linux-mm, Pekka Enberg, David Rientjes, Joonsoo Kim,
	Vlastimil Babka, Roman Gushchin, Hyeonggon Yoo

On Mon, Oct 24, 2022 at 04:14:35PM +0800, Baoquan He wrote:
> SLUB allocator relies on percpu allocator to initialize its ->cpu_slab
> during early boot. For that, the dynamic chunk of percpu which serves
> the early allocation need be large enough to satisfy the kmalloc
> creation.
> 
> However, the current BUILD_BUG_ON() in alloc_kmem_cache_cpus() doesn't
> consider the kmalloc array with NR_KMALLOC_TYPES length. Fix that
> with correct calculation.
> 
> Signed-off-by: Baoquan He <bhe@redhat.com>
> Cc: Christoph Lameter <cl@linux.com>
> Cc: Pekka Enberg <penberg@kernel.org>
> Cc: David Rientjes <rientjes@google.com>
> Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Vlastimil Babka <vbabka@suse.cz>
> Cc: Roman Gushchin <roman.gushchin@linux.dev>
> Cc: Hyeonggon Yoo <42.hyeyoo@gmail.com>
> ---
>  mm/slub.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/mm/slub.c b/mm/slub.c
> index 157527d7101b..8ac3bb9a122a 100644
> --- a/mm/slub.c
> +++ b/mm/slub.c
> @@ -4017,7 +4017,8 @@ init_kmem_cache_node(struct kmem_cache_node *n)
>  static inline int alloc_kmem_cache_cpus(struct kmem_cache *s)
>  {
>  	BUILD_BUG_ON(PERCPU_DYNAMIC_EARLY_SIZE <
> -			KMALLOC_SHIFT_HIGH * sizeof(struct kmem_cache_cpu));
> +			NR_KMALLOC_TYPES * KMALLOC_SHIFT_HIGH *
> +			sizeof(struct kmem_cache_cpu));
>  
>  	/*
>  	 * Must align to double word boundary for the double cmpxchg
> -- 
> 2.34.1
> 

Acked-by: Dennis Zhou <dennis@kernel.org>

Thanks,
Dennis


^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [PATCH 0/8] Cleanup and optimization patches for percpu
  2022-10-24  8:14 [PATCH 0/8] Cleanup and optimization patches for percpu Baoquan He
                   ` (7 preceding siblings ...)
  2022-10-24  8:14 ` [PATCH 8/8] mm/slub, percpu: correct the calculation of early percpu allocation size Baoquan He
@ 2022-10-24 17:09 ` Dennis Zhou
  2022-11-08  7:05 ` Dennis Zhou
  9 siblings, 0 replies; 29+ messages in thread
From: Dennis Zhou @ 2022-10-24 17:09 UTC (permalink / raw)
  To: Baoquan He, Andrew Morton
  Cc: linux-kernel, Tejun Heo, Christoph Lameter, linux-mm

Hello,

On Mon, Oct 24, 2022 at 04:14:27PM +0800, Baoquan He wrote:
> These were found out when reading percpu code, and queued in my local
> branch for long time. Send them out for reviewing.
> 
> Baoquan He (8):
>   mm/percpu: remove unused pcpu_map_extend_chunks
>   mm/percpu: use list_first_entry_or_null in pcpu_reclaim_populated()
>   mm/percpu: Update the code comment when creating new chunk
>   mm/percpu: add comment to state the empty populated pages accounting
>   mm/percpu: replace the goto with break
>   mm/percpu.c: remove the lcm code since block size is fixed at page
>     size
>   mm/percpu: remove unused PERCPU_DYNAMIC_EARLY_SLOTS
>   mm/slub, percpu: correct the calculation of early percpu allocation
>     size
> 
>  include/linux/percpu.h |  7 +++----
>  mm/percpu.c            | 44 +++++++++++++++++-------------------------
>  mm/slub.c              |  3 ++-
>  3 files changed, 23 insertions(+), 31 deletions(-)
> 
> -- 
> 2.34.1
> 
> 

Thanks for the clean ups. The empty page accounting is more subtle than
I remember.


Andrew, I think for these cleanups it'd be easiest for you to pick these
up.

Thanks,
Dennis


^ permalink raw reply	[flat|nested] 29+ messages in thread

* [PATCH v2 2/8] mm/percpu: use list_first_entry_or_null in pcpu_reclaim_populated()
  2022-10-24  8:14 ` [PATCH 2/8] mm/percpu: use list_first_entry_or_null in pcpu_reclaim_populated() Baoquan He
  2022-10-24 10:17   ` kernel test robot
  2022-10-24 16:52   ` Dennis Zhou
@ 2022-10-25  3:11   ` Baoquan He
  2 siblings, 0 replies; 29+ messages in thread
From: Baoquan He @ 2022-10-25  3:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Dennis Zhou, Tejun Heo, Christoph Lameter, Andrew Morton, linux-mm

To replace list_empty()/list_first_entry() pair to simplify code.

Signed-off-by: Baoquan He <bhe@redhat.com>
Acked-by: Dennis Zhou <dennis@kernel.org>
---
v1->v2:
- Add parentheses around assignment in the while condition. This mutes
  the lkp warning.

 mm/percpu.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/mm/percpu.c b/mm/percpu.c
index 26d8cd2ca323..841bb93aaae6 100644
--- a/mm/percpu.c
+++ b/mm/percpu.c
@@ -2143,9 +2143,9 @@ static void pcpu_reclaim_populated(void)
 	 * other accessor is the free path which only returns area back to the
 	 * allocator not touching the populated bitmap.
 	 */
-	while (!list_empty(&pcpu_chunk_lists[pcpu_to_depopulate_slot])) {
-		chunk = list_first_entry(&pcpu_chunk_lists[pcpu_to_depopulate_slot],
-					 struct pcpu_chunk, list);
+	while ((chunk = list_first_entry_or_null(
+			&pcpu_chunk_lists[pcpu_to_depopulate_slot],
+			struct pcpu_chunk, list))) {
 		WARN_ON(chunk->immutable);
 
 		/*
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [PATCH v2 4/8] mm/percpu: add comment to state the empty populated pages accounting
  2022-10-24  8:14 ` [PATCH 4/8] mm/percpu: add comment to state the empty populated pages accounting Baoquan He
  2022-10-24 16:56   ` Dennis Zhou
@ 2022-10-25  3:45   ` Baoquan He
  1 sibling, 0 replies; 29+ messages in thread
From: Baoquan He @ 2022-10-25  3:45 UTC (permalink / raw)
  To: linux-kernel
  Cc: Dennis Zhou, Tejun Heo, Christoph Lameter, Andrew Morton, linux-mm

When allocating an area from a chunk, pcpu_block_update_hint_alloc()
is called to update chunk metadata, including chunk's and global
nr_empty_pop_pages. However, if the allocation is not atomic, some
blocks may not be populated with pages yet, while we still subtract 
the number here. The number of pages will be added back with
pcpu_chunk_populated() when populating pages.

Adding code comment to make that more understandable.

Signed-off-by: Baoquan He <bhe@redhat.com>
---
v1->v2:
- I said the opposite in the v1 code comment. It subtracts the nr_empty_pop_pages
  whether it's atomic allocation or not. In non atomic case, the number
  will be added back in pcpu_chunk_populated() when populating pages.

 mm/percpu.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/mm/percpu.c b/mm/percpu.c
index 68d5ba61c935..786c7a2eb4f0 100644
--- a/mm/percpu.c
+++ b/mm/percpu.c
@@ -831,13 +831,15 @@ static void pcpu_block_update_hint_alloc(struct pcpu_chunk *chunk, int bit_off,
 
 	/*
 	 * Update s_block.
-	 * block->first_free must be updated if the allocation takes its place.
-	 * If the allocation breaks the contig_hint, a scan is required to
-	 * restore this hint.
 	 */
 	if (s_block->contig_hint == PCPU_BITMAP_BLOCK_BITS)
 		nr_empty_pages++;
 
+	/*
+	 * block->first_free must be updated if the allocation takes its place.
+	 * If the allocation breaks the contig_hint, a scan is required to
+	 * restore this hint.
+	 */
 	if (s_off == s_block->first_free)
 		s_block->first_free = find_next_zero_bit(
 					pcpu_index_alloc_map(chunk, s_index),
@@ -912,6 +914,12 @@ static void pcpu_block_update_hint_alloc(struct pcpu_chunk *chunk, int bit_off,
 		}
 	}
 
+	/*
+	 * If the allocation is not atomic, some blocks may not be
+	 * populated with pages, while we account it here. The number
+	 * of pages will be added back with pcpu_chunk_populated()
+	 * when populating pages.
+	 */
 	if (nr_empty_pages)
 		pcpu_update_empty_pages(chunk, -nr_empty_pages);
 
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 29+ messages in thread

* Re: [PATCH 4/8] mm/percpu: add comment to state the empty populated pages accounting
  2022-10-24 16:56   ` Dennis Zhou
@ 2022-10-25  3:47     ` Baoquan He
  0 siblings, 0 replies; 29+ messages in thread
From: Baoquan He @ 2022-10-25  3:47 UTC (permalink / raw)
  To: Dennis Zhou
  Cc: linux-kernel, Tejun Heo, Christoph Lameter, Andrew Morton, linux-mm

On 10/24/22 at 09:56am, Dennis Zhou wrote:
> On Mon, Oct 24, 2022 at 04:14:31PM +0800, Baoquan He wrote:
> > When allocating an area from a chunk, pcpu_block_update_hint_alloc()
> > is called to update chunk metadata, including chunk's and global
> > nr_empty_pop_pages. However, if the allocation is not atomic, some
> > blocks may not be populated with pages yet, while we still account it
> > here. The number of pages will be subtracted with pcpu_chunk_populated()
> > when populating pages.
> > 
> > Adding code comment to make that more understandable.
> > 
> > Signed-off-by: Baoquan He <bhe@redhat.com>
> > ---
> >  mm/percpu.c | 14 +++++++++++---
> >  1 file changed, 11 insertions(+), 3 deletions(-)
> > 
> > diff --git a/mm/percpu.c b/mm/percpu.c
> > index a8121302a79c..09e407338573 100644
> > --- a/mm/percpu.c
> > +++ b/mm/percpu.c
> > @@ -831,13 +831,15 @@ static void pcpu_block_update_hint_alloc(struct pcpu_chunk *chunk, int bit_off,
> >  
> >  	/*
> >  	 * Update s_block.
> > -	 * block->first_free must be updated if the allocation takes its place.
> > -	 * If the allocation breaks the contig_hint, a scan is required to
> > -	 * restore this hint.
> >  	 */
> >  	if (s_block->contig_hint == PCPU_BITMAP_BLOCK_BITS)
> >  		nr_empty_pages++;
> >  
> > +	/*
> > +	 * block->first_free must be updated if the allocation takes its place.
> > +	 * If the allocation breaks the contig_hint, a scan is required to
> > +	 * restore this hint.
> > +	 */
> >  	if (s_off == s_block->first_free)
> >  		s_block->first_free = find_next_zero_bit(
> >  					pcpu_index_alloc_map(chunk, s_index),
> > @@ -912,6 +914,12 @@ static void pcpu_block_update_hint_alloc(struct pcpu_chunk *chunk, int bit_off,
> >  		}
> >  	}
> >  
> > +	/*
> > +	 * If the allocation is not atomic, some blocks may not
> > +	 * be populated with pages, while we account it here.
> > +	 * The number of pages will be subtracted with
> > +	 * pcpu_chunk_populated() when populating pages.
> > +	 */
> >  	if (nr_empty_pages)
> >  		pcpu_update_empty_pages(chunk, -nr_empty_pages);
> >  
> > -- 
> > 2.34.1
> > 
> 
> Heh, that's a little more subtle than I remember it being.
> 
> Acked-by: Dennis Zhou <dennis@kernel.org>

Thanks for reviewing, Dennis.

When I rechecked the code comment, I realized I had said the opposite in
v1 about the newly added code comment. It subtracts the nr_empty_pop_pages
in pcpu_block_update_hint_alloc() whether it's atomic allocation or not.
If non atomic case, the number will be added back in pcpu_chunk_populated()
when populating pages.

I have updated and resent v2, sorry for the mistake.

Thanks
Baoquan



^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [PATCH 8/8] mm/slub, percpu: correct the calculation of early percpu allocation size
  2022-10-24  8:14 ` [PATCH 8/8] mm/slub, percpu: correct the calculation of early percpu allocation size Baoquan He
  2022-10-24 13:52   ` Hyeonggon Yoo
  2022-10-24 17:03   ` Dennis Zhou
@ 2022-11-06 20:56   ` Vlastimil Babka
  2022-11-07  4:35     ` Baoquan He
  2 siblings, 1 reply; 29+ messages in thread
From: Vlastimil Babka @ 2022-11-06 20:56 UTC (permalink / raw)
  To: Baoquan He, linux-kernel
  Cc: Dennis Zhou, Tejun Heo, Christoph Lameter, Andrew Morton,
	linux-mm, Pekka Enberg, David Rientjes, Joonsoo Kim,
	Roman Gushchin, Hyeonggon Yoo

On 10/24/22 10:14, Baoquan He wrote:
> SLUB allocator relies on percpu allocator to initialize its ->cpu_slab
> during early boot. For that, the dynamic chunk of percpu which serves
> the early allocation need be large enough to satisfy the kmalloc
> creation.
> 
> However, the current BUILD_BUG_ON() in alloc_kmem_cache_cpus() doesn't
> consider the kmalloc array with NR_KMALLOC_TYPES length. Fix that
> with correct calculation.
> 
> Signed-off-by: Baoquan He <bhe@redhat.com>
> Cc: Christoph Lameter <cl@linux.com>
> Cc: Pekka Enberg <penberg@kernel.org>
> Cc: David Rientjes <rientjes@google.com>
> Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Vlastimil Babka <vbabka@suse.cz>
> Cc: Roman Gushchin <roman.gushchin@linux.dev>
> Cc: Hyeonggon Yoo <42.hyeyoo@gmail.com>
> ---
>  mm/slub.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

As only slub is touched and there's no prerequsities in the previous
patches, I took this to the slab tree, branch
slab/for-6.2/cleanups

Thanks!

> 
> diff --git a/mm/slub.c b/mm/slub.c
> index 157527d7101b..8ac3bb9a122a 100644
> --- a/mm/slub.c
> +++ b/mm/slub.c
> @@ -4017,7 +4017,8 @@ init_kmem_cache_node(struct kmem_cache_node *n)
>  static inline int alloc_kmem_cache_cpus(struct kmem_cache *s)
>  {
>  	BUILD_BUG_ON(PERCPU_DYNAMIC_EARLY_SIZE <
> -			KMALLOC_SHIFT_HIGH * sizeof(struct kmem_cache_cpu));
> +			NR_KMALLOC_TYPES * KMALLOC_SHIFT_HIGH *
> +			sizeof(struct kmem_cache_cpu));
>  
>  	/*
>  	 * Must align to double word boundary for the double cmpxchg



^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [PATCH 8/8] mm/slub, percpu: correct the calculation of early percpu allocation size
  2022-11-06 20:56   ` Vlastimil Babka
@ 2022-11-07  4:35     ` Baoquan He
  2022-11-07  7:20       ` Dennis Zhou
  0 siblings, 1 reply; 29+ messages in thread
From: Baoquan He @ 2022-11-07  4:35 UTC (permalink / raw)
  To: Vlastimil Babka
  Cc: linux-kernel, Dennis Zhou, Tejun Heo, Christoph Lameter,
	Andrew Morton, linux-mm, Pekka Enberg, David Rientjes,
	Joonsoo Kim, Roman Gushchin, Hyeonggon Yoo

On 11/06/22 at 09:56pm, Vlastimil Babka wrote:
> On 10/24/22 10:14, Baoquan He wrote:
> > SLUB allocator relies on percpu allocator to initialize its ->cpu_slab
> > during early boot. For that, the dynamic chunk of percpu which serves
> > the early allocation need be large enough to satisfy the kmalloc
> > creation.
> > 
> > However, the current BUILD_BUG_ON() in alloc_kmem_cache_cpus() doesn't
> > consider the kmalloc array with NR_KMALLOC_TYPES length. Fix that
> > with correct calculation.
> > 
> > Signed-off-by: Baoquan He <bhe@redhat.com>
> > Cc: Christoph Lameter <cl@linux.com>
> > Cc: Pekka Enberg <penberg@kernel.org>
> > Cc: David Rientjes <rientjes@google.com>
> > Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
> > Cc: Andrew Morton <akpm@linux-foundation.org>
> > Cc: Vlastimil Babka <vbabka@suse.cz>
> > Cc: Roman Gushchin <roman.gushchin@linux.dev>
> > Cc: Hyeonggon Yoo <42.hyeyoo@gmail.com>
> > ---
> >  mm/slub.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> As only slub is touched and there's no prerequsities in the previous
> patches, I took this to the slab tree, branch
> slab/for-6.2/cleanups

Yes, it only changes slub code. Thanks for taking it.

I will resend v2 with the left 7 percpu only patches with update.



^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [PATCH 8/8] mm/slub, percpu: correct the calculation of early percpu allocation size
  2022-11-07  4:35     ` Baoquan He
@ 2022-11-07  7:20       ` Dennis Zhou
  2022-11-07  8:23         ` Baoquan He
  0 siblings, 1 reply; 29+ messages in thread
From: Dennis Zhou @ 2022-11-07  7:20 UTC (permalink / raw)
  To: Baoquan He
  Cc: Vlastimil Babka, linux-kernel, Tejun Heo, Christoph Lameter,
	Andrew Morton, linux-mm, Pekka Enberg, David Rientjes,
	Joonsoo Kim, Roman Gushchin, Hyeonggon Yoo

Hi Baoquan,

On Mon, Nov 07, 2022 at 12:35:56PM +0800, Baoquan He wrote:
> On 11/06/22 at 09:56pm, Vlastimil Babka wrote:
> > On 10/24/22 10:14, Baoquan He wrote:
> > > SLUB allocator relies on percpu allocator to initialize its ->cpu_slab
> > > during early boot. For that, the dynamic chunk of percpu which serves
> > > the early allocation need be large enough to satisfy the kmalloc
> > > creation.
> > > 
> > > However, the current BUILD_BUG_ON() in alloc_kmem_cache_cpus() doesn't
> > > consider the kmalloc array with NR_KMALLOC_TYPES length. Fix that
> > > with correct calculation.
> > > 
> > > Signed-off-by: Baoquan He <bhe@redhat.com>
> > > Cc: Christoph Lameter <cl@linux.com>
> > > Cc: Pekka Enberg <penberg@kernel.org>
> > > Cc: David Rientjes <rientjes@google.com>
> > > Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
> > > Cc: Andrew Morton <akpm@linux-foundation.org>
> > > Cc: Vlastimil Babka <vbabka@suse.cz>
> > > Cc: Roman Gushchin <roman.gushchin@linux.dev>
> > > Cc: Hyeonggon Yoo <42.hyeyoo@gmail.com>
> > > ---
> > >  mm/slub.c | 3 ++-
> > >  1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > As only slub is touched and there's no prerequsities in the previous
> > patches, I took this to the slab tree, branch
> > slab/for-6.2/cleanups
> 
> Yes, it only changes slub code. Thanks for taking it.
> 
> I will resend v2 with the left 7 percpu only patches with update.
> 
> 

Don't worry about resending them, I'll pick them up tomorrow morning.

Thanks,
Dennis


^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [PATCH 8/8] mm/slub, percpu: correct the calculation of early percpu allocation size
  2022-11-07  7:20       ` Dennis Zhou
@ 2022-11-07  8:23         ` Baoquan He
  0 siblings, 0 replies; 29+ messages in thread
From: Baoquan He @ 2022-11-07  8:23 UTC (permalink / raw)
  To: Dennis Zhou
  Cc: Vlastimil Babka, linux-kernel, Tejun Heo, Christoph Lameter,
	Andrew Morton, linux-mm, Pekka Enberg, David Rientjes,
	Joonsoo Kim, Roman Gushchin, Hyeonggon Yoo

On 11/06/22 at 11:20pm, Dennis Zhou wrote:
> Hi Baoquan,
> 
> On Mon, Nov 07, 2022 at 12:35:56PM +0800, Baoquan He wrote:
> > On 11/06/22 at 09:56pm, Vlastimil Babka wrote:
> > > On 10/24/22 10:14, Baoquan He wrote:
> > > > SLUB allocator relies on percpu allocator to initialize its ->cpu_slab
> > > > during early boot. For that, the dynamic chunk of percpu which serves
> > > > the early allocation need be large enough to satisfy the kmalloc
> > > > creation.
> > > > 
> > > > However, the current BUILD_BUG_ON() in alloc_kmem_cache_cpus() doesn't
> > > > consider the kmalloc array with NR_KMALLOC_TYPES length. Fix that
> > > > with correct calculation.
> > > > 
> > > > Signed-off-by: Baoquan He <bhe@redhat.com>
> > > > Cc: Christoph Lameter <cl@linux.com>
> > > > Cc: Pekka Enberg <penberg@kernel.org>
> > > > Cc: David Rientjes <rientjes@google.com>
> > > > Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
> > > > Cc: Andrew Morton <akpm@linux-foundation.org>
> > > > Cc: Vlastimil Babka <vbabka@suse.cz>
> > > > Cc: Roman Gushchin <roman.gushchin@linux.dev>
> > > > Cc: Hyeonggon Yoo <42.hyeyoo@gmail.com>
> > > > ---
> > > >  mm/slub.c | 3 ++-
> > > >  1 file changed, 2 insertions(+), 1 deletion(-)
> > > 
> > > As only slub is touched and there's no prerequsities in the previous
> > > patches, I took this to the slab tree, branch
> > > slab/for-6.2/cleanups
> > 
> > Yes, it only changes slub code. Thanks for taking it.
> > 
> > I will resend v2 with the left 7 percpu only patches with update.
> > 
> > 
> 
> Don't worry about resending them, I'll pick them up tomorrow morning.

That's great. Thanks a lot, Dennis.



^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [PATCH 0/8] Cleanup and optimization patches for percpu
  2022-10-24  8:14 [PATCH 0/8] Cleanup and optimization patches for percpu Baoquan He
                   ` (8 preceding siblings ...)
  2022-10-24 17:09 ` [PATCH 0/8] Cleanup and optimization patches for percpu Dennis Zhou
@ 2022-11-08  7:05 ` Dennis Zhou
  2022-11-08  9:14   ` Baoquan He
  9 siblings, 1 reply; 29+ messages in thread
From: Dennis Zhou @ 2022-11-08  7:05 UTC (permalink / raw)
  To: Baoquan He
  Cc: linux-kernel, Tejun Heo, Christoph Lameter, Andrew Morton, linux-mm

Hello Baoquan,

On Mon, Oct 24, 2022 at 04:14:27PM +0800, Baoquan He wrote:
> These were found out when reading percpu code, and queued in my local
> branch for long time. Send them out for reviewing.
> 
> Baoquan He (8):
>   mm/percpu: remove unused pcpu_map_extend_chunks
>   mm/percpu: use list_first_entry_or_null in pcpu_reclaim_populated()
>   mm/percpu: Update the code comment when creating new chunk
>   mm/percpu: add comment to state the empty populated pages accounting
>   mm/percpu: replace the goto with break
>   mm/percpu.c: remove the lcm code since block size is fixed at page
>     size
>   mm/percpu: remove unused PERCPU_DYNAMIC_EARLY_SLOTS
>   mm/slub, percpu: correct the calculation of early percpu allocation
>     size
> 
>  include/linux/percpu.h |  7 +++----
>  mm/percpu.c            | 44 +++++++++++++++++-------------------------
>  mm/slub.c              |  3 ++-
>  3 files changed, 23 insertions(+), 31 deletions(-)
> 
> -- 
> 2.34.1
> 
> 

I've applied patches 1-7 to for-6.2.

Thanks,
Dennis


^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [PATCH 0/8] Cleanup and optimization patches for percpu
  2022-11-08  7:05 ` Dennis Zhou
@ 2022-11-08  9:14   ` Baoquan He
  0 siblings, 0 replies; 29+ messages in thread
From: Baoquan He @ 2022-11-08  9:14 UTC (permalink / raw)
  To: Dennis Zhou
  Cc: linux-kernel, Tejun Heo, Christoph Lameter, Andrew Morton, linux-mm

On 11/07/22 at 11:05pm, Dennis Zhou wrote:
> Hello Baoquan,
> 
> On Mon, Oct 24, 2022 at 04:14:27PM +0800, Baoquan He wrote:
> > These were found out when reading percpu code, and queued in my local
> > branch for long time. Send them out for reviewing.
> > 
> > Baoquan He (8):
> >   mm/percpu: remove unused pcpu_map_extend_chunks
> >   mm/percpu: use list_first_entry_or_null in pcpu_reclaim_populated()
> >   mm/percpu: Update the code comment when creating new chunk
> >   mm/percpu: add comment to state the empty populated pages accounting
> >   mm/percpu: replace the goto with break
> >   mm/percpu.c: remove the lcm code since block size is fixed at page
> >     size
> >   mm/percpu: remove unused PERCPU_DYNAMIC_EARLY_SLOTS
> >   mm/slub, percpu: correct the calculation of early percpu allocation
> >     size
> > 
> >  include/linux/percpu.h |  7 +++----
> >  mm/percpu.c            | 44 +++++++++++++++++-------------------------
> >  mm/slub.c              |  3 ++-
> >  3 files changed, 23 insertions(+), 31 deletions(-)
> > 
> > -- 
> > 2.34.1
> > 
> > 
> 
> I've applied patches 1-7 to for-6.2.

Thanks a lot.



^ permalink raw reply	[flat|nested] 29+ messages in thread

end of thread, other threads:[~2022-11-08  9:14 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-24  8:14 [PATCH 0/8] Cleanup and optimization patches for percpu Baoquan He
2022-10-24  8:14 ` [PATCH 1/8] mm/percpu: remove unused pcpu_map_extend_chunks Baoquan He
2022-10-24 16:51   ` Dennis Zhou
2022-10-24  8:14 ` [PATCH 2/8] mm/percpu: use list_first_entry_or_null in pcpu_reclaim_populated() Baoquan He
2022-10-24 10:17   ` kernel test robot
2022-10-24 16:52   ` Dennis Zhou
2022-10-25  3:11   ` [PATCH v2 " Baoquan He
2022-10-24  8:14 ` [PATCH 3/8] mm/percpu: Update the code comment when creating new chunk Baoquan He
2022-10-24 16:54   ` Dennis Zhou
2022-10-24  8:14 ` [PATCH 4/8] mm/percpu: add comment to state the empty populated pages accounting Baoquan He
2022-10-24 16:56   ` Dennis Zhou
2022-10-25  3:47     ` Baoquan He
2022-10-25  3:45   ` [PATCH v2 " Baoquan He
2022-10-24  8:14 ` [PATCH 5/8] mm/percpu: replace the goto with break Baoquan He
2022-10-24 17:00   ` Dennis Zhou
2022-10-24  8:14 ` [PATCH 6/8] mm/percpu.c: remove the lcm code since block size is fixed at page size Baoquan He
2022-10-24 17:00   ` Dennis Zhou
2022-10-24  8:14 ` [PATCH 7/8] mm/percpu: remove unused PERCPU_DYNAMIC_EARLY_SLOTS Baoquan He
2022-10-24 17:03   ` Dennis Zhou
2022-10-24  8:14 ` [PATCH 8/8] mm/slub, percpu: correct the calculation of early percpu allocation size Baoquan He
2022-10-24 13:52   ` Hyeonggon Yoo
2022-10-24 17:03   ` Dennis Zhou
2022-11-06 20:56   ` Vlastimil Babka
2022-11-07  4:35     ` Baoquan He
2022-11-07  7:20       ` Dennis Zhou
2022-11-07  8:23         ` Baoquan He
2022-10-24 17:09 ` [PATCH 0/8] Cleanup and optimization patches for percpu Dennis Zhou
2022-11-08  7:05 ` Dennis Zhou
2022-11-08  9:14   ` Baoquan He

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).