linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/slub: fix missing ALLOC_SLOWPATH stat when bulk alloc
@ 2020-08-11  2:24 wuyun.wu
  2020-08-11  6:50 ` Pekka Enberg
  2020-08-11 21:40 ` David Rientjes
  0 siblings, 2 replies; 3+ messages in thread
From: wuyun.wu @ 2020-08-11  2:24 UTC (permalink / raw)
  To: Christoph Lameter, Pekka Enberg, David Rientjes, Joonsoo Kim,
	Andrew Morton
  Cc: hewenliang4, hushiyuan, Abel Wu, open list:SLAB ALLOCATOR, open list

From: Abel Wu <wuyun.wu@huawei.com>

The ALLOC_SLOWPATH statistics is missing in bulk allocation now.
Fix it by doing statistics in alloc slow path.

Signed-off-by: Abel Wu <wuyun.wu@huawei.com>
---
 mm/slub.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/mm/slub.c b/mm/slub.c
index df93a5a0e9a4..5d89e4064f83 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -2600,6 +2600,8 @@ static void *___slab_alloc(struct kmem_cache *s, gfp_t gfpflags, int node,
 	void *freelist;
 	struct page *page;
 
+	stat(s, ALLOC_SLOWPATH);
+
 	page = c->page;
 	if (!page) {
 		/*
@@ -2788,7 +2790,6 @@ static __always_inline void *slab_alloc_node(struct kmem_cache *s,
 	page = c->page;
 	if (unlikely(!object || !node_match(page, node))) {
 		object = __slab_alloc(s, gfpflags, node, addr, c);
-		stat(s, ALLOC_SLOWPATH);
 	} else {
 		void *next_object = get_freepointer_safe(s, object);
 
-- 
2.28.0.windows.1


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

* Re: [PATCH] mm/slub: fix missing ALLOC_SLOWPATH stat when bulk alloc
  2020-08-11  2:24 [PATCH] mm/slub: fix missing ALLOC_SLOWPATH stat when bulk alloc wuyun.wu
@ 2020-08-11  6:50 ` Pekka Enberg
  2020-08-11 21:40 ` David Rientjes
  1 sibling, 0 replies; 3+ messages in thread
From: Pekka Enberg @ 2020-08-11  6:50 UTC (permalink / raw)
  To: wuyun.wu
  Cc: Christoph Lameter, David Rientjes, Joonsoo Kim, Andrew Morton,
	hewenliang4, hushiyuan, open list:SLAB ALLOCATOR, open list

On Tue, Aug 11, 2020 at 5:25 AM <wuyun.wu@huawei.com> wrote:
>
> From: Abel Wu <wuyun.wu@huawei.com>
>
> The ALLOC_SLOWPATH statistics is missing in bulk allocation now.
> Fix it by doing statistics in alloc slow path.
>
> Signed-off-by: Abel Wu <wuyun.wu@huawei.com>

Reviewed-by: Pekka Enberg <penberg@kernel.org>

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

* Re: [PATCH] mm/slub: fix missing ALLOC_SLOWPATH stat when bulk alloc
  2020-08-11  2:24 [PATCH] mm/slub: fix missing ALLOC_SLOWPATH stat when bulk alloc wuyun.wu
  2020-08-11  6:50 ` Pekka Enberg
@ 2020-08-11 21:40 ` David Rientjes
  1 sibling, 0 replies; 3+ messages in thread
From: David Rientjes @ 2020-08-11 21:40 UTC (permalink / raw)
  To: Abel Wu
  Cc: Christoph Lameter, Pekka Enberg, Joonsoo Kim, Andrew Morton,
	hewenliang4, hushiyuan, open list:SLAB ALLOCATOR, open list

On Tue, 11 Aug 2020, wuyun.wu@huawei.com wrote:

> From: Abel Wu <wuyun.wu@huawei.com>
> 
> The ALLOC_SLOWPATH statistics is missing in bulk allocation now.
> Fix it by doing statistics in alloc slow path.
> 
> Signed-off-by: Abel Wu <wuyun.wu@huawei.com>
> ---
>  mm/slub.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/mm/slub.c b/mm/slub.c
> index df93a5a0e9a4..5d89e4064f83 100644
> --- a/mm/slub.c
> +++ b/mm/slub.c
> @@ -2600,6 +2600,8 @@ static void *___slab_alloc(struct kmem_cache *s, gfp_t gfpflags, int node,
>  	void *freelist;
>  	struct page *page;
>  
> +	stat(s, ALLOC_SLOWPATH);
> +
>  	page = c->page;
>  	if (!page) {
>  		/*
> @@ -2788,7 +2790,6 @@ static __always_inline void *slab_alloc_node(struct kmem_cache *s,
>  	page = c->page;
>  	if (unlikely(!object || !node_match(page, node))) {
>  		object = __slab_alloc(s, gfpflags, node, addr, c);
> -		stat(s, ALLOC_SLOWPATH);
>  	} else {
>  		void *next_object = get_freepointer_safe(s, object);
>  

Acked-by: David Rientjes <rientjes@google.com>

> -- 
> 2.28.0.windows.1

Lol :)

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

end of thread, other threads:[~2020-08-11 21:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-11  2:24 [PATCH] mm/slub: fix missing ALLOC_SLOWPATH stat when bulk alloc wuyun.wu
2020-08-11  6:50 ` Pekka Enberg
2020-08-11 21:40 ` David Rientjes

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).