linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Vlastimil Babka <vbabka@suse.cz>
To: Miaohe Lin <linmiaohe@huawei.com>,
	akpm@linux-foundation.org, cl@linux.com, penberg@kernel.org,
	rientjes@google.com, iamjoonsoo.kim@lge.com
Cc: gregkh@linuxfoundation.org, faiyazm@codeaurora.org,
	andreyknvl@gmail.com, ryabinin.a.a@gmail.com,
	thgarnie@google.com, keescook@chromium.org,
	bharata@linux.ibm.com, guro@fb.com, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 5/5] mm, slub: fix incorrect memcg slab count for bulk free
Date: Tue, 5 Oct 2021 12:50:08 +0200	[thread overview]
Message-ID: <25db026b-76bc-cad3-7913-c310fc6cd822@suse.cz> (raw)
In-Reply-To: <20210916123920.48704-6-linmiaohe@huawei.com>

On 9/16/21 14:39, Miaohe Lin wrote:
> kmem_cache_free_bulk() will call memcg_slab_free_hook() for all objects
> when doing bulk free. So we shouldn't call memcg_slab_free_hook() again
> for bulk free to avoid incorrect memcg slab count.
> 
> Fixes: d1b2cf6cb84a ("mm: memcg/slab: uncharge during kmem_cache_free_bulk()")
> Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>

Reviewed-by: Vlastimil Babka <vbabka@suse.cz>

I now noticed the series doesn't Cc: stable and it should, so I hope Andrew
can add those together with the review tags. Thanks.

> ---
>  mm/slub.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/mm/slub.c b/mm/slub.c
> index f3df0f04a472..d8f77346376d 100644
> --- a/mm/slub.c
> +++ b/mm/slub.c
> @@ -3420,7 +3420,9 @@ static __always_inline void do_slab_free(struct kmem_cache *s,
>  	struct kmem_cache_cpu *c;
>  	unsigned long tid;
>  
> -	memcg_slab_free_hook(s, &head, 1);
> +	/* memcg_slab_free_hook() is already called for bulk free. */
> +	if (!tail)
> +		memcg_slab_free_hook(s, &head, 1);
>  redo:
>  	/*
>  	 * Determine the currently cpus per cpu slab.
> 



  reply	other threads:[~2021-10-05 10:50 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-16 12:39 [PATCH 0/5] Fixups for slub Miaohe Lin
2021-09-16 12:39 ` [PATCH 1/5] mm, slub: fix two bugs in slab_debug_trace_open() Miaohe Lin
2021-10-05  9:46   ` Vlastimil Babka
2021-09-16 12:39 ` [PATCH 2/5] mm, slub: fix mismatch between reconstructed freelist depth and cnt Miaohe Lin
2021-10-05  9:57   ` Vlastimil Babka
2021-10-08  2:01     ` Miaohe Lin
2021-09-16 12:39 ` [PATCH 3/5] mm, slub: fix potential memoryleak in kmem_cache_open() Miaohe Lin
2021-10-05 10:02   ` Vlastimil Babka
2021-09-16 12:39 ` [PATCH 4/5] mm, slub: fix potential use-after-free in slab_debugfs_fops Miaohe Lin
2021-10-05 10:36   ` Vlastimil Babka
2021-09-16 12:39 ` [PATCH 5/5] mm, slub: fix incorrect memcg slab count for bulk free Miaohe Lin
2021-10-05 10:50   ` Vlastimil Babka [this message]
2021-10-05 21:43     ` Andrew Morton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=25db026b-76bc-cad3-7913-c310fc6cd822@suse.cz \
    --to=vbabka@suse.cz \
    --cc=akpm@linux-foundation.org \
    --cc=andreyknvl@gmail.com \
    --cc=bharata@linux.ibm.com \
    --cc=cl@linux.com \
    --cc=faiyazm@codeaurora.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=guro@fb.com \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=keescook@chromium.org \
    --cc=linmiaohe@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=penberg@kernel.org \
    --cc=rientjes@google.com \
    --cc=ryabinin.a.a@gmail.com \
    --cc=thgarnie@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox