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
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 <[email protected]>
---
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
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 <[email protected]>
---
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
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 <[email protected]>
> ---
> 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 <[email protected]>
Thanks,
Dennis
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 <[email protected]>
> ---
> 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 <[email protected]>
Thanks,
Dennis
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
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
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.