Re: [PATCH 2/2] mm, util: account_locked_vm() does not hold mmap_lock

2020-08-02 Thread Pengfei Li
On Thu, 30 Jul 2020 16:57:05 -0400 Daniel Jordan wrote: > On Wed, Jul 29, 2020 at 12:21:11PM -0700, Hugh Dickins wrote: > > On Sun, 26 Jul 2020, Pengfei Li wrote: > > > > > Since mm->locked_vm is already an atomic counter, > > > account_locked_vm() does not n

Re: [PATCH 2/2] mm, util: account_locked_vm() does not hold mmap_lock

2020-08-02 Thread Pengfei Li
On Wed, 29 Jul 2020 12:21:11 -0700 (PDT) Hugh Dickins wrote: Sorry for the late reply. > On Sun, 26 Jul 2020, Pengfei Li wrote: > > > Since mm->locked_vm is already an atomic counter, > > account_locked_vm() does not need to hold mmap_lock. > > I am worried tha

[PATCH 2/2] mm, util: account_locked_vm() does not hold mmap_lock

2020-07-26 Thread Pengfei Li
Since mm->locked_vm is already an atomic counter, account_locked_vm() does not need to hold mmap_lock. Signed-off-by: Pengfei Li --- drivers/vfio/vfio_iommu_type1.c | 8 ++-- mm/util.c | 15 +++ 2 files changed, 5 insertions(+), 18 deletions(-) diff --

[PATCH 1/2] mm: make mm->locked_vm an atomic64 counter

2020-07-26 Thread Pengfei Li
need to worry about overflow. Signed-off-by: Pengfei Li --- drivers/infiniband/sw/siw/siw_verbs.c | 12 +++- drivers/vfio/vfio_iommu_type1.c | 6 -- fs/io_uring.c | 4 ++-- fs/proc/task_mmu.c| 2 +- include/linux/mm_types.

Re: [PATCH v6 0/3] mm, slab: Make kmalloc_info[] contain all types of names

2019-10-08 Thread Pengfei Li
On Thu, Oct 3, 2019 at 7:06 AM Andrew Morton wrote: > > On Mon, 23 Sep 2019 20:27:25 +0800 Pengfei Li wrote: > > > Changes in v6 > > -- > > 1. abandon patch 4-7 (Because there is not enough reason to explain > > that they are beneficial) > > So http://l

[PATCH v6 2/3] mm, slab: Remove unused kmalloc_size()

2019-09-23 Thread Pengfei Li
The size of kmalloc can be obtained from kmalloc_info[], so remove kmalloc_size() that will not be used anymore. Signed-off-by: Pengfei Li Acked-by: Vlastimil Babka Acked-by: Roman Gushchin Acked-by: David Rientjes --- include/linux/slab.h | 20 mm/slab.c| 5

[PATCH v6 1/3] mm, slab: Make kmalloc_info[] contain all types of names

2019-09-23 Thread Pengfei Li
of kmalloc to save the time spent dynamically generating names. Besides, remove the kmalloc_cache_name() that is no longer used. Signed-off-by: Pengfei Li Acked-by: Vlastimil Babka Acked-by: Roman Gushchin Acked-by: David Rientjes --- mm/slab.c| 2 +- mm/slab.h| 2 +- mm

[PATCH v6 3/3] mm, slab_common: Use enum kmalloc_cache_type to iterate over kmalloc caches

2019-09-23 Thread Pengfei Li
The type of local variable *type* of new_kmalloc_cache() should be enum kmalloc_cache_type instead of int, so correct it. Signed-off-by: Pengfei Li Acked-by: Vlastimil Babka Acked-by: Roman Gushchin Acked-by: David Rientjes --- mm/slab_common.c | 5 +++-- 1 file changed, 3 insertions(+), 2

[PATCH v6 0/3] mm, slab: Make kmalloc_info[] contain all types of names

2019-09-23 Thread Pengfei Li
() (CPU cycles) 5.3-rc7 66264 5.3-rc7+patch42188 Pengfei Li (3): mm, slab: Make kmalloc_info[] contain all types of names mm, slab: Remove unused kmalloc_size() mm, slab_common: Use enum kmalloc_cache_type to iterate over kmalloc

Re: [RESEND v4 5/7] mm, slab_common: Make kmalloc_caches[] start at size KMALLOC_MIN_SIZE

2019-09-17 Thread Pengfei Li
On Mon, Sep 16, 2019 at 5:38 AM David Rientjes wrote: > > On Mon, 16 Sep 2019, Pengfei Li wrote: > > > Currently, kmalloc_cache[] is not sorted by size, kmalloc_cache[0] > > is kmalloc-96, kmalloc_cache[1] is kmalloc-192 (when ARCH_DMA_MINALIGN > > is not def

Re: [RFC PATCH] mm/slub: remove left-over debugging code

2019-09-17 Thread Pengfei Li
move them to make the world greener. > > Adding Pengfei Li who has been working on a patchset for modified handling > of kmalloc cache initialization and touches the resiliency test. > Thanks for looping me in. My opinion is the same as David Rientjes. The resiliency test should not be rem

Re: [PATCH v5 0/7] mm, slab: Make kmalloc_info[] contain all types of names

2019-09-17 Thread Pengfei Li
On Tue, Sep 17, 2019 at 12:04 AM Christopher Lameter wrote: > > On Mon, 16 Sep 2019, Pengfei Li wrote: > > > The name of KMALLOC_NORMAL is contained in kmalloc_info[].name, > > but the names of KMALLOC_RECLAIM and KMALLOC_DMA are dynamically > > generated by kmalloc_c

Re: [RESEND v4 5/7] mm, slab_common: Make kmalloc_caches[] start at size KMALLOC_MIN_SIZE

2019-09-16 Thread Pengfei Li
e, please drop us a note to > help improve the system] > > url: > https://github.com/0day-ci/linux/commits/Pengfei-Li/mm-slab-Make-kmalloc_info-contain-all-types-of-names/20190916-065820 > reproduce: > # apt-get install sparse > # sparse version: v0.6.1-rc

Re: [RESEND v4 5/7] mm, slab_common: Make kmalloc_caches[] start at size KMALLOC_MIN_SIZE

2019-09-16 Thread Pengfei Li
rop us a note to > help improve the system] > > url: > https://github.com/0day-ci/linux/commits/Pengfei-Li/mm-slab-Make-kmalloc_info-contain-all-types-of-names/20190916-065820 > config: parisc-allmodconfig (attached as .config) > compiler: hppa-linux-gcc (GCC)

Re: [RESEND v4 6/7] mm, slab_common: Initialize the same size of kmalloc_caches[]

2019-09-16 Thread Pengfei Li
On Mon, Sep 16, 2019 at 5:38 AM David Rientjes wrote: Thanks for your review comments! > > On Mon, 16 Sep 2019, Pengfei Li wrote: > > > diff --git a/mm/slab_common.c b/mm/slab_common.c > > index 2aed30deb071..e7903bd28b1f 100644 > > --- a/mm/slab_common.c

Re: [RESEND v4 1/7] mm, slab: Make kmalloc_info[] contain all types of names

2019-09-16 Thread Pengfei Li
On Mon, Sep 16, 2019 at 5:38 AM David Rientjes wrote: > > On Mon, 16 Sep 2019, Pengfei Li wrote: > > > There are three types of kmalloc, KMALLOC_NORMAL, KMALLOC_RECLAIM > > and KMALLOC_DMA. > > > > The name of KMALLOC_NORMAL is contained in kmall

[PATCH v5 7/7] mm, slab_common: Modify kmalloc_caches[type][idx] to kmalloc_caches[idx][type]

2019-09-16 Thread Pengfei Li
955 934 -21 Total: Before=14788957, After=14788507, chg -0.00% Signed-off-by: Pengfei Li Acked-by: David Rientjes --- include/linux/slab.h | 6 +++--- mm/slab.c| 4 ++-- mm/slab_common.c | 8 mm/slub.c| 12 ++-- 4 files

[PATCH v5 6/7] mm, slab_common: Initialize the same size of kmalloc_caches[]

2019-09-16 Thread Pengfei Li
ches(). And I found that for SLAB, KMALLOC_DMA is initialized before "slab_state = UP". But for SLUB, KMALLOC_DMA is initialized after "slab_state = UP". Based on this fact, I think it is okay to initialize KMALLOC_DMA before "slab_state = UP". Sig

[PATCH v5 5/7] mm, slab_common: Make kmalloc_caches[] start at size KMALLOC_MIN_SIZE

2019-09-16 Thread Pengfei Li
cache_name57 - -57 new_kmalloc_cache112 --112 kmalloc_info 432 8-424 Total: Before=14789209, After=14788968, chg -0.00% Signed-off-by: Pengfei Li --- include/linux/slab.h | 96

[PATCH v5 4/7] mm, slab: Return ZERO_SIZE_ALLOC for zero sized kmalloc requests

2019-09-16 Thread Pengfei Li
This is a preparation patch, just replace 0 with ZERO_SIZE_ALLOC as the return value of zero sized requests. Signed-off-by: Pengfei Li Acked-by: David Rientjes --- include/linux/slab.h | 16 +++- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/include/linux/slab.h b

[PATCH v5 3/7] mm, slab_common: Use enum kmalloc_cache_type to iterate over kmalloc caches

2019-09-16 Thread Pengfei Li
The type of local variable *type* of new_kmalloc_cache() should be enum kmalloc_cache_type instead of int, so correct it. Signed-off-by: Pengfei Li Acked-by: Vlastimil Babka Acked-by: Roman Gushchin Acked-by: David Rientjes --- mm/slab_common.c | 5 +++-- 1 file changed, 3 insertions(+), 2

[PATCH v5 2/7] mm, slab: Remove unused kmalloc_size()

2019-09-16 Thread Pengfei Li
The size of kmalloc can be obtained from kmalloc_info[], so remove kmalloc_size() that will not be used anymore. Signed-off-by: Pengfei Li Acked-by: Vlastimil Babka Acked-by: Roman Gushchin Acked-by: David Rientjes --- include/linux/slab.h | 20 mm/slab.c| 5

[PATCH v5 1/7] mm, slab: Make kmalloc_info[] contain all types of names

2019-09-16 Thread Pengfei Li
of kmalloc to save the time spent dynamically generating names. Besides, remove the kmalloc_cache_name() that is no longer used. Signed-off-by: Pengfei Li Acked-by: Vlastimil Babka Acked-by: Roman Gushchin Acked-by: David Rientjes --- mm/slab.c| 2 +- mm/slab.h| 2 +- mm

[PATCH v5 0/7] mm, slab: Make kmalloc_info[] contain all types of names

2019-09-16 Thread Pengfei Li
- -57 create_kmalloc_caches270 195 -75 new_kmalloc_cache112 --112 kmalloc_info 432 8-424 Total: Before=14789209, After=14788507, chg -0.00% Pengfei Li (7): mm, slab: Make

[RESEND v4 5/7] mm, slab_common: Make kmalloc_caches[] start at size KMALLOC_MIN_SIZE

2019-09-15 Thread Pengfei Li
cache_name57 - -57 new_kmalloc_cache112 --112 kmalloc_info 432 8-424 Total: Before=14874616, After=14874375, chg -0.00% Signed-off-by: Pengfei Li --- include/linux/slab.h | 96

[RESEND v4 7/7] mm, slab_common: Modify kmalloc_caches[type][idx] to kmalloc_caches[idx][type]

2019-09-15 Thread Pengfei Li
955 934 -21 Total: Before=14874316, After=14873867, chg -0.00% Signed-off-by: Pengfei Li --- include/linux/slab.h | 6 +++--- mm/slab.c| 4 ++-- mm/slab_common.c | 8 mm/slub.c| 12 ++-- 4 files changed, 15 insertions

[RESEND v4 3/7] mm, slab_common: Use enum kmalloc_cache_type to iterate over kmalloc caches

2019-09-15 Thread Pengfei Li
The type of local variable *type* of new_kmalloc_cache() should be enum kmalloc_cache_type instead of int, so correct it. Signed-off-by: Pengfei Li Acked-by: Vlastimil Babka Acked-by: Roman Gushchin --- mm/slab_common.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git

[RESEND v4 4/7] mm, slab: Return ZERO_SIZE_ALLOC for zero sized kmalloc requests

2019-09-15 Thread Pengfei Li
This is a preparation patch, just replace 0 with ZERO_SIZE_ALLOC as the return value of zero sized requests. Signed-off-by: Pengfei Li --- include/linux/slab.h | 16 +++- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/include/linux/slab.h b/include/linux/slab.h index

[RESEND v4 6/7] mm, slab_common: Initialize the same size of kmalloc_caches[]

2019-09-15 Thread Pengfei Li
Based on this fact, I think it is okay to initialize KMALLOC_DMA before "slab_state = UP". Signed-off-by: Pengfei Li --- mm/slab_common.c | 35 --- 1 file changed, 12 insertions(+), 23 deletions(-) diff --git a/mm/slab_common.c b/mm/slab_common.

[RESEND v4 2/7] mm, slab: Remove unused kmalloc_size()

2019-09-15 Thread Pengfei Li
The size of kmalloc can be obtained from kmalloc_info[], so remove kmalloc_size() that will not be used anymore. Signed-off-by: Pengfei Li Acked-by: Vlastimil Babka Acked-by: Roman Gushchin --- include/linux/slab.h | 20 mm/slab.c| 5 +++-- mm/slab_common.c

[RESEND v4 1/7] mm, slab: Make kmalloc_info[] contain all types of names

2019-09-15 Thread Pengfei Li
of kmalloc to save the time spent dynamically generating names. Besides, remove the kmalloc_cache_name() that is no longer used. Signed-off-by: Pengfei Li Acked-by: Vlastimil Babka Acked-by: Roman Gushchin --- mm/slab.c| 2 +- mm/slab.h| 2 +- mm/slab_common.c | 91

[RESEND v4 0/7] mm, slab: Make kmalloc_info[] contain all types of names

2019-09-15 Thread Pengfei Li
create_kmalloc_caches270 148-122 kmalloc_info 432 8-424 Total: Before=14874616, After=14873867, chg -0.01% Pengfei Li (7): mm, slab: Make kmalloc_info[] contain all types of names mm, slab: Remove unused kmalloc_size() mm

[PATCH v4 7/7] mm, slab_common: Modify kmalloc_caches[type][idx] to kmalloc_caches[idx][type]

2019-09-15 Thread Pengfei Li
955 934 -21 Total: Before=14874316, After=14873867, chg -0.00% Signed-off-by: Pengfei Li --- include/linux/slab.h | 6 +++--- mm/slab.c| 4 ++-- mm/slab_common.c | 8 mm/slub.c| 12 ++-- 4 files changed, 15 insertions

[PATCH v4 7/7] mm, slab_common: modify kmalloc_caches[type][idx] to kmalloc_caches[idx][type]

2019-09-15 Thread Pengfei Li
955 934 -21 Total: Before=14874316, After=14873867, chg -0.00% Signed-off-by: Pengfei Li --- include/linux/slab.h | 6 +++--- mm/slab.c| 4 ++-- mm/slab_common.c | 8 mm/slub.c| 12 ++-- 4 files changed, 15 insertions

[PATCH v4 6/7] mm, slab_common: Initialize the same size of kmalloc_caches[]

2019-09-15 Thread Pengfei Li
Based on this fact, I think it is okay to initialize KMALLOC_DMA before "slab_state = UP". Signed-off-by: Pengfei Li --- mm/slab_common.c | 35 --- 1 file changed, 12 insertions(+), 23 deletions(-) diff --git a/mm/slab_common.c b/mm/slab_common.

[PATCH v4 4/7] mm, slab: return ZERO_SIZE_ALLOC for zero sized kmalloc requests

2019-09-15 Thread Pengfei Li
This is a preparation patch, just replace 0 with ZERO_SIZE_ALLOC as the return value of zero sized requests. Signed-off-by: Pengfei Li --- include/linux/slab.h | 16 +++- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/include/linux/slab.h b/include/linux/slab.h index

[PATCH v4 4/7] mm, slab: Return ZERO_SIZE_ALLOC for zero sized kmalloc requests

2019-09-15 Thread Pengfei Li
This is a preparation patch, just replace 0 with ZERO_SIZE_ALLOC as the return value of zero sized requests. Signed-off-by: Pengfei Li --- include/linux/slab.h | 16 +++- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/include/linux/slab.h b/include/linux/slab.h index

[PATCH v4 6/7] mm, slab_common: initialize the same size of kmalloc_caches[]

2019-09-15 Thread Pengfei Li
Based on this fact, I think it is okay to initialize KMALLOC_DMA before "slab_state = UP". Signed-off-by: Pengfei Li --- mm/slab_common.c | 35 --- 1 file changed, 12 insertions(+), 23 deletions(-) diff --git a/mm/slab_common.c b/mm/slab_common.

[PATCH v4 5/7] mm, slab_common: make kmalloc_caches[] start at size KMALLOC_MIN_SIZE

2019-09-15 Thread Pengfei Li
cache_name57 - -57 new_kmalloc_cache112 --112 kmalloc_info 432 8-424 Total: Before=14874616, After=14874375, chg -0.00% Signed-off-by: Pengfei Li --- include/linux/slab.h | 96

[PATCH v4 5/7] mm, slab_common: Make kmalloc_caches[] start at size KMALLOC_MIN_SIZE

2019-09-15 Thread Pengfei Li
cache_name57 - -57 new_kmalloc_cache112 --112 kmalloc_info 432 8-424 Total: Before=14874616, After=14874375, chg -0.00% Signed-off-by: Pengfei Li --- include/linux/slab.h | 96

[PATCH v4 3/7] mm, slab_common: Use enum kmalloc_cache_type to iterate over kmalloc caches

2019-09-15 Thread Pengfei Li
The type of local variable *type* of new_kmalloc_cache() should be enum kmalloc_cache_type instead of int, so correct it. Signed-off-by: Pengfei Li Acked-by: Vlastimil Babka Acked-by: Roman Gushchin --- mm/slab_common.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git

[PATCH v4 2/7] mm, slab: Remove unused kmalloc_size()

2019-09-15 Thread Pengfei Li
The size of kmalloc can be obtained from kmalloc_info[], so remove kmalloc_size() that will not be used anymore. Signed-off-by: Pengfei Li Acked-by: Vlastimil Babka Acked-by: Roman Gushchin --- include/linux/slab.h | 20 mm/slab.c| 5 +++-- mm/slab_common.c

[PATCH v4 3/7] mm, slab_common: use enum kmalloc_cache_type to iterate over kmalloc caches

2019-09-15 Thread Pengfei Li
The type of local variable *type* of new_kmalloc_cache() should be enum kmalloc_cache_type instead of int, so correct it. Signed-off-by: Pengfei Li Acked-by: Vlastimil Babka Acked-by: Roman Gushchin --- mm/slab_common.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git

[PATCH v4 0/7] mm, slab: Make kmalloc_info[] contain all types of names

2019-09-15 Thread Pengfei Li
create_kmalloc_caches270 148-122 kmalloc_info 432 8-424 Total: Before=14874616, After=14873867, chg -0.01% Pengfei Li (7): mm, slab: Make kmalloc_info[] contain all types of names mm, slab: Remove unused kmalloc_size() mm

[PATCH v4 1/7] mm, slab: Make kmalloc_info[] contain all types of names

2019-09-15 Thread Pengfei Li
of kmalloc to save the time spent dynamically generating names. Besides, remove the kmalloc_cache_name() that is no longer used. Signed-off-by: Pengfei Li Acked-by: Vlastimil Babka Acked-by: Roman Gushchin --- mm/slab.c| 2 +- mm/slab.h| 2 +- mm/slab_common.c | 91

Re: [PATCH v3 4/4] mm, slab_common: Make the loop for initializing KMALLOC_DMA start from 1

2019-09-11 Thread Pengfei Li
On Tue, Sep 10, 2019 at 6:26 PM Vlastimil Babka wrote: > > On 9/10/19 3:26 AM, Pengfei Li wrote: > > KMALLOC_DMA will be initialized only if KMALLOC_NORMAL with > > the same index exists. > > > > And kmalloc_caches[KMALLOC_NORMAL][0] is always NULL. > > >

[PATCH v3 4/4] mm, slab_common: Make the loop for initializing KMALLOC_DMA start from 1

2019-09-09 Thread Pengfei Li
KMALLOC_DMA will be initialized only if KMALLOC_NORMAL with the same index exists. And kmalloc_caches[KMALLOC_NORMAL][0] is always NULL. Therefore, the loop that initializes KMALLOC_DMA should start at 1 instead of 0, which will reduce 1 meaningless attempt. Signed-off-by: Pengfei Li --- mm

[PATCH v3 1/4] mm, slab: Make kmalloc_info[] contain all types of names

2019-09-09 Thread Pengfei Li
of kmalloc to save the time spent dynamically generating names. Besides, remove the kmalloc_cache_name() that is no longer used. Signed-off-by: Pengfei Li Acked-by: Vlastimil Babka Acked-by: Roman Gushchin --- mm/slab.c| 2 +- mm/slab.h| 2 +- mm/slab_common.c | 91

[PATCH v3 0/4] mm, slab: Make kmalloc_info[] contain all types of names

2019-09-09 Thread Pengfei Li
did some cleanup work. These changes make sense, and the time spent by new_kmalloc_cache() has been reduced by approximately 36.3%. Time spent by new_kmalloc_cache() 5.3-rc7 66264 5.3-rc7+patch 42188 Pengfei

[PATCH v3 2/4] mm, slab: Remove unused kmalloc_size()

2019-09-09 Thread Pengfei Li
The size of kmalloc can be obtained from kmalloc_info[], so remove kmalloc_size() that will not be used anymore. Signed-off-by: Pengfei Li Acked-by: Vlastimil Babka Acked-by: Roman Gushchin --- include/linux/slab.h | 20 mm/slab.c| 5 +++-- mm/slab_common.c

[PATCH v3 3/4] mm, slab_common: use enum kmalloc_cache_type to iterate over kmalloc caches

2019-09-09 Thread Pengfei Li
The type of local variable *type* of new_kmalloc_cache() should be enum kmalloc_cache_type instead of int, so correct it. Signed-off-by: Pengfei Li Acked-by: Vlastimil Babka Acked-by: Roman Gushchin --- mm/slab_common.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git

Re: [PATCH v2 3/4] mm, slab_common: Make 'type' is enum kmalloc_cache_type

2019-09-09 Thread Pengfei Li
On Tue, Sep 10, 2019 at 4:00 AM Roman Gushchin wrote: > > On Tue, Sep 10, 2019 at 01:07:14AM +0800, Pengfei Li wrote: > > Hi Pengfei! > > > The 'type' of the function new_kmalloc_cache should be > > enum kmalloc_cache_type instead of int, so correct it. > >

Re: [PATCH 1/5] mm, slab: Make kmalloc_info[] contain all types of names

2019-09-09 Thread Pengfei Li
On Tue, Sep 10, 2019 at 2:30 AM Rasmus Villemoes wrote: > > On 09/09/2019 18.53, Pengfei Li wrote: > > On Mon, Sep 9, 2019 at 10:59 PM Vlastimil Babka wrote: > > >>> /* > >>>* kmalloc_info[] is to make slub_debug=,kmalloc-xx option work at boo

[PATCH v2 4/4] mm, slab_common: Make initializing KMALLOC_DMA start from 1

2019-09-09 Thread Pengfei Li
kmalloc_caches[KMALLOC_NORMAL][0] will never be initialized, so the loop should start at 1 instead of 0 Signed-off-by: Pengfei Li --- mm/slab_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/slab_common.c b/mm/slab_common.c index d64a64660f86..6b3e526934d9 100644

[PATCH v2 2/4] mm, slab: Remove unused kmalloc_size()

2019-09-09 Thread Pengfei Li
The size of kmalloc can be obtained from kmalloc_info[], so remove kmalloc_size() that will not be used anymore. Signed-off-by: Pengfei Li Acked-by: Vlastimil Babka --- include/linux/slab.h | 20 mm/slab.c| 5 +++-- mm/slab_common.c | 5 ++--- 3 files

[PATCH v2 1/4] mm, slab: Make kmalloc_info[] contain all types of names

2019-09-09 Thread Pengfei Li
of kmalloc to save the time spent dynamically generating names. Besides, remove the kmalloc_cache_name() that is no longer used. Signed-off-by: Pengfei Li Acked-by: Vlastimil Babka --- mm/slab.c| 2 +- mm/slab.h| 2 +- mm/slab_common.c | 93

[PATCH v2 3/4] mm, slab_common: Make 'type' is enum kmalloc_cache_type

2019-09-09 Thread Pengfei Li
The 'type' of the function new_kmalloc_cache should be enum kmalloc_cache_type instead of int, so correct it. Signed-off-by: Pengfei Li Acked-by: Vlastimil Babka --- mm/slab_common.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mm/slab_common.c b/mm/slab_common.c

[PATCH v2 0/4] mm, slab: Make kmalloc_info[] contain all types of names

2019-09-09 Thread Pengfei Li
by approximately 36.3%. Time spent by new_kmalloc_cache() 5.3-rc7 66264 5.3-rc7+patch 42188 Pengfei Li (4): mm, slab: Make kmalloc_info[] contain all types of names mm, slab: Remove unused kmalloc_size() mm

Re: [PATCH 2/5] mm, slab_common: Remove unused kmalloc_cache_name()

2019-09-09 Thread Pengfei Li
On Mon, Sep 9, 2019 at 10:59 PM Vlastimil Babka wrote: > > On 9/3/19 6:04 PM, Pengfei Li wrote: > > Since the name of kmalloc can be obtained from kmalloc_info[], > > remove the kmalloc_cache_name() that is no longer used. > > That could simply be part of patch 1

Re: [PATCH 1/5] mm, slab: Make kmalloc_info[] contain all types of names

2019-09-09 Thread Pengfei Li
On Mon, Sep 9, 2019 at 10:59 PM Vlastimil Babka wrote: > > On 9/3/19 6:04 PM, Pengfei Li wrote: > > There are three types of kmalloc, KMALLOC_NORMAL, KMALLOC_RECLAIM > > and KMALLOC_DMA. > > > > The name of KMALLOC_NORMAL is contained in kmalloc_info[].name, > &

Re: [PATCH 0/5] mm, slab: Make kmalloc_info[] contain all types of names

2019-09-05 Thread Pengfei Li
On Thu, Sep 5, 2019 at 8:25 PM Vlastimil Babka wrote: > > On 9/3/19 6:04 PM, Pengfei Li wrote: > > There are three types of kmalloc, KMALLOC_NORMAL, KMALLOC_RECLAIM > > and KMALLOC_DMA. > > > > The name of KMALLOC_NORMAL is contained in kmalloc_info[].name, > &

Re: [PATCH 0/5] mm, slab: Make kmalloc_info[] contain all types of names

2019-09-04 Thread Pengfei Li
On Thu, Sep 5, 2019 at 3:27 AM Christopher Lameter wrote: > > On Wed, 4 Sep 2019, Pengfei Li wrote: > > > There are three types of kmalloc, KMALLOC_NORMAL, KMALLOC_RECLAIM > > and KMALLOC_DMA. > > I only got a few patches of this set. Can I see the complete patchset >

[PATCH 5/5] mm, slab_common: Make initializing KMALLOC_DMA start from 1

2019-09-03 Thread Pengfei Li
kmalloc_caches[KMALLOC_NORMAL][0] will never be initialized, so the loop should start at 1 instead of 0 Signed-off-by: Pengfei Li --- mm/slab_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/slab_common.c b/mm/slab_common.c index af45b5278fdc..c81fc7dc2946 100644

[PATCH 4/5] mm, slab_common: Make 'type' is enum kmalloc_cache_type

2019-09-03 Thread Pengfei Li
The 'type' of the function new_kmalloc_cache should be enum kmalloc_cache_type instead of int, so correct it. Signed-off-by: Pengfei Li --- mm/slab_common.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mm/slab_common.c b/mm/slab_common.c index 8b542cfcc4f2

[PATCH 3/5] mm, slab: Remove unused kmalloc_size()

2019-09-03 Thread Pengfei Li
The size of kmalloc can be obtained from kmalloc_info[], so remove kmalloc_size() that will not be used anymore. Signed-off-by: Pengfei Li --- include/linux/slab.h | 20 mm/slab.c| 5 +++-- mm/slab_common.c | 5 ++--- 3 files changed, 5 insertions(+), 25

[PATCH 2/5] mm, slab_common: Remove unused kmalloc_cache_name()

2019-09-03 Thread Pengfei Li
Since the name of kmalloc can be obtained from kmalloc_info[], remove the kmalloc_cache_name() that is no longer used. Signed-off-by: Pengfei Li --- mm/slab_common.c | 15 --- 1 file changed, 15 deletions(-) diff --git a/mm/slab_common.c b/mm/slab_common.c index 7bd88cc09987

[PATCH 1/5] mm, slab: Make kmalloc_info[] contain all types of names

2019-09-03 Thread Pengfei Li
of kmalloc to save the time spent dynamically generating names. Signed-off-by: Pengfei Li --- mm/slab.c| 2 +- mm/slab.h| 2 +- mm/slab_common.c | 76 +++- 3 files changed, 51 insertions(+), 29 deletions(-) diff --git a/mm/slab.c b/mm

[PATCH 0/5] mm, slab: Make kmalloc_info[] contain all types of names

2019-09-03 Thread Pengfei Li
-rc7 66264 5.3-rc7+patch 42188 Pengfei Li (5): mm, slab: Make kmalloc_info[] contain all types of names mm, slab_common: Remove unused kmalloc_cache_name() mm, slab: Remove unused kmalloc_size() mm, slab_common: Make 'type' is enum kmalloc_cache_type mm

Re: [PATCH] mm/page_alloc: cleanup __alloc_pages_direct_compact()

2019-08-19 Thread Pengfei Li
On Mon, Aug 19, 2019 at 9:50 PM Vlastimil Babka wrote: > > On 8/17/19 12:51 PM, Pengfei Li wrote: > > This patch cleans up the if(page). > > > > No functional change. > > > > Signed-off-by: Pengfei Li > > I don't see much benefit here. The indentation w

[PATCH] mm/page_alloc: cleanup __alloc_pages_direct_compact()

2019-08-17 Thread Pengfei Li
This patch cleans up the if(page). No functional change. Signed-off-by: Pengfei Li --- mm/page_alloc.c | 28 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 272c6de1bf4e..51f056ac09f5 100644 --- a/mm

[PATCH] mm/compaction: remove unnecessary zone parameter in isolate_migratepages()

2019-08-06 Thread Pengfei Li
Like commit 40cacbcb3240 ("mm, compaction: remove unnecessary zone parameter in some instances"), remove unnecessary zone parameter. No functional change. Signed-off-by: Pengfei Li --- mm/compaction.c | 13 ++--- 1 file changed, 6 insertions(+), 7 deletions(-) diff

Re: [PATCH 00/10] make "order" unsigned int

2019-07-29 Thread Pengfei Li
On Mon, Jul 29, 2019 at 4:34 PM Mel Gorman wrote: > > On Sun, Jul 28, 2019 at 12:44:36AM +0800, Pengfei Li wrote: > > On Fri, Jul 26, 2019 at 3:26 PM Mel Gorman > > wrote: > > > > > > > Thank you for your comments. > > > > > On F

Re: [PATCH 00/10] make "order" unsigned int

2019-07-27 Thread Pengfei Li
On Fri, Jul 26, 2019 at 3:12 PM Michal Hocko wrote: > Thank you for your comments. > On Fri 26-07-19 07:48:36, Pengfei Li wrote: > [...] > > For the benefit, "order" may be negative, which is confusing and weird. > > order = -1 has a special meaning. > Yes. Bu

Re: [PATCH 00/10] make "order" unsigned int

2019-07-27 Thread Pengfei Li
On Fri, Jul 26, 2019 at 3:26 PM Mel Gorman wrote: > Thank you for your comments. > On Fri, Jul 26, 2019 at 02:42:43AM +0800, Pengfei Li wrote: > > Objective > > > > The motivation for this series of patches is use unsigned int for > > "order" in

Re: [PATCH 02/10] mm/page_alloc: use unsigned int for "order" in __rmqueue_fallback()

2019-07-26 Thread Pengfei Li
On Fri, Jul 26, 2019 at 5:36 PM Rasmus Villemoes wrote: > > On 25/07/2019 20.42, Pengfei Li wrote: > > Because "order" will never be negative in __rmqueue_fallback(), > > so just make "order" unsigned int. > > And modify trace_mm_page_alloc_extf

Re: [PATCH 00/10] make "order" unsigned int

2019-07-25 Thread Pengfei Li
On Fri, Jul 26, 2019 at 2:52 AM Qian Cai wrote: > > On Fri, 2019-07-26 at 02:42 +0800, Pengfei Li wrote: > > Objective > > > > The motivation for this series of patches is use unsigned int for > > "order" in compaction.c, just like in other memory subs

Re: [PATCH 01/10] mm/page_alloc: use unsigned int for "order" in should_compact_retry()

2019-07-25 Thread Pengfei Li
On Fri, Jul 26, 2019 at 2:58 AM Matthew Wilcox wrote: > > On Fri, Jul 26, 2019 at 02:42:44AM +0800, Pengfei Li wrote: > > static inline bool > > -should_compact_retry(struct alloc_context *ac, int order, int alloc_flags, > > - enum compa

[PATCH 09/10] mm/compaction: use unsigned int for "kcompactd_max_order" in struct pglist_data

2019-07-25 Thread Pengfei Li
Because "kcompactd_max_order" will never be negative, so just make it unsigned int. Signed-off-by: Pengfei Li --- include/linux/compaction.h | 6 -- include/linux/mmzone.h | 2 +- mm/compaction.c| 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git

[PATCH 10/10] mm/vmscan: use unsigned int for "kswapd_order" in struct pglist_data

2019-07-25 Thread Pengfei Li
Because "kswapd_order" will never be negative, so just make it unsigned int. And modify wakeup_kswapd(), kswapd_try_to_sleep() and trace_mm_vmscan_kswapd_wake() accordingly. Besides, make "order" unsigned int in two related trace functions. Signed-off-by: Pengfei Li --- in

[PATCH 08/10] mm/compaction: use unsigned int for "compact_order_failed" in struct zone

2019-07-25 Thread Pengfei Li
Because "compact_order_failed" will never be negative, so just make it unsigned int. And modify three related trace functions accordingly. Signed-off-by: Pengfei Li --- include/linux/compaction.h| 12 ++-- include/linux/mmzone.h| 2 +- include/tr

[PATCH 06/10] mm/compaction: make "order" unsigned int in compaction.c

2019-07-25 Thread Pengfei Li
Since compact_control->order and compact_control->search_order have been modified to unsigned int in the previous commit, then some of the functions in compaction.c are modified accordingly. Signed-off-by: Pengfei Li --- include/linux/compaction.h | 12 ++-- mm/compac

[PATCH 07/10] trace/events/compaction: make "order" unsigned int

2019-07-25 Thread Pengfei Li
Make the same type as "compact_control->order". Signed-off-by: Pengfei Li --- include/trace/events/compaction.h | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/include/trace/events/compaction.h b/include/trace/events/compaction.h index

[PATCH 03/10] mm/page_alloc: use unsigned int for "order" in should_compact_retry()

2019-07-25 Thread Pengfei Li
Because "order" will never be negative in should_compact_retry(), so just make "order" unsigned int. Signed-off-by: Pengfei Li --- mm/page_alloc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 1432cbcd87cd.

[PATCH 05/10] mm/compaction: make "order" and "search_order" unsigned int in struct compact_control

2019-07-25 Thread Pengfei Li
ed int, and after reverting fast_search_fail to unsigned int, compact_control is still within two cache lines. Signed-off-by: Pengfei Li --- mm/compaction.c | 96 + mm/internal.h | 6 ++-- 2 files changed, 53 insertions(+), 49 deletions(-) diff

[PATCH 04/10] mm/page_alloc: remove never used "order" in alloc_contig_range()

2019-07-25 Thread Pengfei Li
The "order" will never be used in alloc_contig_range(), and "order" is a negative number is very strange. So just remove it. Signed-off-by: Pengfei Li --- mm/page_alloc.c | 1 - 1 file changed, 1 deletion(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 7d47af09461f.

[PATCH 02/10] mm/page_alloc: use unsigned int for "order" in __rmqueue_fallback()

2019-07-25 Thread Pengfei Li
Because "order" will never be negative in __rmqueue_fallback(), so just make "order" unsigned int. And modify trace_mm_page_alloc_extfrag() accordingly. Signed-off-by: Pengfei Li --- include/trace/events/kmem.h | 6 +++--- mm/page_alloc.c | 4 ++-- 2 files c

[PATCH 00/10] make "order" unsigned int

2019-07-25 Thread Pengfei Li
some stress testing locally and have not found any problems. In addition, local tests indicate no performance impact. Pengfei Li (10): mm/page_alloc: use unsigned int for "order" in should_compact_retry() mm/page_alloc: use unsigned int for "order" in __rmqueue_fallback() mm/pa

[PATCH 01/10] mm/page_alloc: use unsigned int for "order" in should_compact_retry()

2019-07-25 Thread Pengfei Li
Like another should_compact_retry(), use unsigned int for "order". And modify trace_compact_retry() accordingly. Signed-off-by: Pengfei Li --- include/trace/events/oom.h | 6 +++--- mm/page_alloc.c| 7 +++ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git

Re: [PATCH v6 1/2] mm/vmalloc: do not keep unpurged areas in the busy tree

2019-07-25 Thread Pengfei Li
Thanks. Signed-off-by: Pengfei Li On Thu, Jul 25, 2019 at 10:36 AM Andrew Morton wrote: > > On Tue, 16 Jul 2019 23:26:55 +0800 Pengfei Li wrote: > > > From: "Uladzislau Rezki (Sony)" > > > > The busy tree can be quite big, even though the area is

[PATCH v6 2/2] mm/vmalloc: modify struct vmap_area to reduce its size

2019-07-16 Thread Pengfei Li
;flags". Since only one flag VM_VM_AREA is being used, and the same thing can be done by judging whether "vm" is NULL, then the "flags" can be eliminated. Signed-off-by: Pengfei Li Suggested-by: Uladzislau Rezki (Sony) --- include/linux/vmalloc.h | 20 +--- m

[PATCH v6 1/2] mm/vmalloc: do not keep unpurged areas in the busy tree

2019-07-16 Thread Pengfei Li
From: "Uladzislau Rezki (Sony)" The busy tree can be quite big, even though the area is freed or unmapped it still stays there until "purge" logic removes it. 1) Optimize and reduce the size of "busy" tree by removing a node from it right away as soon as user triggers free paths. It is possible

[PATCH v6 0/2] mm/vmalloc.c: improve readability and rewrite vmap_area

2019-07-16 Thread Pengfei Li
pletely overwriting va_start. The current implementation of struct vmap_area wasted space. After applying this commit, sizeof(struct vmap_area) has been reduced from 11 words to 8 words. Pengfei Li (1): mm/vmalloc: modify struct vmap_area to reduce its size Uladzislau Rezki (Sony) (1): mm/vmalloc

Re: [PATCH v5 2/2] mm/vmalloc: modify struct vmap_area to reduce its size

2019-07-16 Thread Pengfei Li
On Tue, Jul 16, 2019 at 10:35 PM Uladzislau Rezki wrote: > > On Tue, Jul 16, 2019 at 09:26:04PM +0800, Pengfei Li wrote: > > Objective > > - > > The current implementation of struct vmap_area wasted space. > > > > After applying this commit, sizeof(st

[PATCH v5 1/2] mm/vmalloc: do not keep unpurged areas in the busy tree

2019-07-16 Thread Pengfei Li
From: "Uladzislau Rezki (Sony)" The busy tree can be quite big, even though the area is freed or unmapped it still stays there until "purge" logic removes it. 1) Optimize and reduce the size of "busy" tree by removing a node from it right away as soon as user triggers free paths. It is possible

[PATCH v5 2/2] mm/vmalloc: modify struct vmap_area to reduce its size

2019-07-16 Thread Pengfei Li
;flags". Since only one flag VM_VM_AREA is being used, and the same thing can be done by judging whether "vm" is NULL, then the "flags" can be eliminated. Signed-off-by: Pengfei Li Suggested-by: Uladzislau Rezki (Sony) --- include/linux/vmalloc.h | 20 +--- m

[PATCH v5 0/2] mm/vmalloc.c: improve readability and rewrite vmap_area

2019-07-16 Thread Pengfei Li
f struct vmap_area wasted space. After applying this commit, sizeof(struct vmap_area) has been reduced from 11 words to 8 words. Pengfei Li (1): mm/vmalloc: modify struct vmap_area to reduce its size Uladzislau Rezki (Sony) (1): mm/vmalloc: do not keep unpurged areas in the busy tree inc

Re: [PATCH v4 2/2] mm/vmalloc.c: Modify struct vmap_area to reduce its size

2019-07-15 Thread Pengfei Li
Hi, Vlad Thanks for the comments form you and Matthew, now I am sure v3 is enough. I will follow the next version of your "mm/vmalloc: do not keep unpurged areas in the busy tree". Thanks again for your patience with me! -- Pengfei

Re: [PATCH v4 2/2] mm/vmalloc.c: Modify struct vmap_area to reduce its size

2019-07-12 Thread Pengfei Li
On Fri, Jul 12, 2019 at 9:49 PM Matthew Wilcox wrote: > > On Fri, Jul 12, 2019 at 08:02:13PM +0800, Pengfei Li wrote: > > I don't think you need struct union struct union. Because llist_node > is just a pointer, you can get the same savings with just: > > union { >

[PATCH v4 2/2] mm/vmalloc.c: Modify struct vmap_area to reduce its size

2019-07-12 Thread Pengfei Li
n be packed with other variables, which are only used in rbtree and list sorted by address. 3) Eliminate "flags". Since only one flag VM_VM_AREA is being used, and the same thing can be done by judging whether "vm" is NULL, then the "flags"

[PATCH v4 0/2] mm/vmalloc.c: improve readability and rewrite vmap_area

2019-07-12 Thread Pengfei Li
message. * patch 5: Let va->flags use only some low bits of va_start instead of completely overwriting va_start. The current implementation of struct vmap_area wasted space. After applying this commit, sizeof(struct vmap_area) has been reduced from 11 words to 8 words. Pengfei

  1   2   >