2020-08-11 02:28:03

by Abel Wu

[permalink] [raw]
Subject: [PATCH] mm/slub: fix missing ALLOC_SLOWPATH stat when bulk alloc

From: Abel Wu <[email protected]>

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

Signed-off-by: Abel Wu <[email protected]>
---
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


2020-08-11 06:52:12

by Pekka Enberg

[permalink] [raw]
Subject: Re: [PATCH] mm/slub: fix missing ALLOC_SLOWPATH stat when bulk alloc

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

Reviewed-by: Pekka Enberg <[email protected]>

2020-08-11 21:43:54

by David Rientjes

[permalink] [raw]
Subject: Re: [PATCH] mm/slub: fix missing ALLOC_SLOWPATH stat when bulk alloc

On Tue, 11 Aug 2020, [email protected] wrote:

> From: Abel Wu <[email protected]>
>
> The ALLOC_SLOWPATH statistics is missing in bulk allocation now.
> Fix it by doing statistics in alloc slow path.
>
> Signed-off-by: Abel Wu <[email protected]>
> ---
> 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 <[email protected]>

> --
> 2.28.0.windows.1

Lol :)