From: Roman Gushchin <guro@fb.com>
To: Vasily Averin <vvs@virtuozzo.com>
Cc: <cgroups@vger.kernel.org>, <linux-mm@kvack.org>,
Johannes Weiner <hannes@cmpxchg.org>,
Michal Hocko <mhocko@kernel.org>,
Vladimir Davydov <vdavydov.dev@gmail.com>
Subject: Re: [PATCH 1/9] memcg: accounting for allocations called with disabled BH
Date: Tue, 9 Mar 2021 12:39:18 -0800 [thread overview]
Message-ID: <YEfc9uCc8sfs7ooT@carbon.dhcp.thefacebook.com> (raw)
In-Reply-To: <18a0ae77-89ff-2679-ab19-378e38ce2be2@virtuozzo.com>
On Tue, Mar 09, 2021 at 11:03:48AM +0300, Vasily Averin wrote:
> in_interrupt() check in memcg_kmem_bypass() is incorrect because
> it does not allow to account memory allocation called from task context
> with disabled BH, i.e. inside spin_lock_bh()/spin_unlock_bh() sections
>
> Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
Good catch!
It looks like the bug was there for years: in_interrupt() was there since
the commit 7ae1e1d0f8ac ("memcg: kmem controller infrastructure") from 2012!
So I guess there is no point for a stable fix, but it's definitely nice to
have it fixed.
Acked-by: Roman Gushchin <guro@fb.com>
for this patch and the rest of the series.
Thank you!
> ---
> mm/memcontrol.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index 845eec0..568f2cb 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -1076,7 +1076,7 @@ static __always_inline bool memcg_kmem_bypass(void)
> return false;
>
> /* Memcg to charge can't be determined. */
> - if (in_interrupt() || !current->mm || (current->flags & PF_KTHREAD))
> + if (!in_task() || !current->mm || (current->flags & PF_KTHREAD))
> return true;
>
> return false;
> --
> 1.8.3.1
>
next prev parent reply other threads:[~2021-03-09 20:39 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-09 8:03 Vasily Averin
2021-03-09 14:57 ` Michal Hocko
2021-03-10 9:11 ` Vasily Averin
2021-03-10 9:40 ` Michal Hocko
2021-03-09 19:39 ` Shakeel Butt
2021-03-09 20:18 ` Roman Gushchin
2021-03-10 9:21 ` Vasily Averin
2021-03-10 9:42 ` Michal Hocko
2021-03-10 19:09 ` Roman Gushchin
2021-03-10 9:17 ` Vasily Averin
2021-03-09 20:39 ` Roman Gushchin [this message]
2021-03-10 9:26 ` Vasily Averin
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=YEfc9uCc8sfs7ooT@carbon.dhcp.thefacebook.com \
--to=guro@fb.com \
--cc=cgroups@vger.kernel.org \
--cc=hannes@cmpxchg.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.org \
--cc=vdavydov.dev@gmail.com \
--cc=vvs@virtuozzo.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