linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Michal Hocko <mhocko@kernel.org>
To: Yafang Shao <laoar.shao@gmail.com>
Cc: hannes@cmpxchg.org, vdavydov.dev@gmail.com,
	cgroups@vger.kernel.org, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm: avoid bothering interrupted task when charge memcg in softirq
Date: Mon, 16 Jul 2018 09:58:36 +0200	[thread overview]
Message-ID: <20180716075836.GC17280@dhcp22.suse.cz> (raw)
In-Reply-To: <1531557122-12540-1-git-send-email-laoar.shao@gmail.com>

On Sat 14-07-18 16:32:02, Yafang Shao wrote:
> try_charge maybe executed in packet receive path, which is in interrupt
> context.
> In this situation, the 'current' is the interrupted task, which may has
> no relation to the rx softirq, So it is nonsense to use 'current'.
> 
> Avoid bothering the interrupted if page_counter_try_charge failes.

I agree with Shakeel that this changelog asks for more information about
"why it matters". Small inconsistencies should be tolerable because the
state we rely on is so rarely set that it shouldn't make a visible
difference in practice.

> Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
> ---
>  mm/memcontrol.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index 68ef266..13f95db 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -2123,6 +2123,9 @@ static int try_charge(struct mem_cgroup *memcg, gfp_t gfp_mask,
>  		goto retry;
>  	}
>  
> +	if (in_softirq())
> +		goto nomem;
> +

If anything would it make more sense to use in_interrupt() to be more
bullet proof for future?

>  	/*
>  	 * Unlike in global OOM situations, memcg is not in a physical
>  	 * memory shortage.  Allow dying and OOM-killed tasks to
> -- 
> 1.8.3.1

-- 
Michal Hocko
SUSE Labs

  parent reply	other threads:[~2018-07-16  7:58 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-14  8:32 Yafang Shao
2018-07-14 15:38 ` Shakeel Butt
2018-07-15  2:10   ` Yafang Shao
2018-07-15  2:25     ` Yafang Shao
2018-07-15  4:25     ` Shakeel Butt
2018-07-15  5:25       ` Yafang Shao
2018-07-15  6:34         ` Shakeel Butt
2018-07-15  8:01           ` Yafang Shao
2018-07-15 15:04             ` Shakeel Butt
2018-07-16  1:49               ` Yafang Shao
2018-07-16  3:09                 ` Shakeel Butt
2018-07-16  3:38                   ` Yafang Shao
2018-07-16  7:58 ` Michal Hocko [this message]
2018-07-16  9:45   ` Yafang Shao
2018-07-16 11:08     ` Michal Hocko

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=20180716075836.GC17280@dhcp22.suse.cz \
    --to=mhocko@kernel.org \
    --cc=cgroups@vger.kernel.org \
    --cc=hannes@cmpxchg.org \
    --cc=laoar.shao@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=vdavydov.dev@gmail.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