linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yu Zhao <yuzhao@google.com>
To: Tim Chen <tim.c.chen@linux.intel.com>
Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Linux-MM <linux-mm@kvack.org>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	Huang Ying <ying.huang@intel.com>,
	Shakeel Butt <shakeelb@google.com>,
	Michal Hocko <mhocko@suse.com>,
	wfg@mail.ustc.edu.cn
Subject: Re: [RFC] mm/vmscan.c: avoid possible long latency caused by too_many_isolated()
Date: Thu, 22 Apr 2021 14:30:04 -0600	[thread overview]
Message-ID: <CAOUHufbVmsvWQ-_PSn8CCanuJqRR6Tmj01s17WvKsc3pRa87xw@mail.gmail.com> (raw)
In-Reply-To: <a085478d-5118-cdff-c611-1649fce7a650@linux.intel.com>

On Thu, Apr 22, 2021 at 2:17 PM Tim Chen <tim.c.chen@linux.intel.com> wrote:
>
>
>
> On 4/22/21 10:13 AM, Yu Zhao wrote:
>
> > @@ -3302,6 +3252,7 @@ static bool throttle_direct_reclaim(gfp_t gfp_mask, struct zonelist *zonelist,
> >  unsigned long try_to_free_pages(struct zonelist *zonelist, int order,
> >                               gfp_t gfp_mask, nodemask_t *nodemask)
> >  {
> > +     int nr_cpus;
> >       unsigned long nr_reclaimed;
> >       struct scan_control sc = {
> >               .nr_to_reclaim = SWAP_CLUSTER_MAX,
> > @@ -3334,8 +3285,17 @@ unsigned long try_to_free_pages(struct zonelist *zonelist, int order,
> >       set_task_reclaim_state(current, &sc.reclaim_state);
> >       trace_mm_vmscan_direct_reclaim_begin(order, sc.gfp_mask);
> >
> > +     nr_cpus = current_is_kswapd() ? 0 : num_online_cpus();
> > +     while (nr_cpus && !atomic_add_unless(&pgdat->nr_reclaimers, 1, nr_cpus)) {
> > +             if (schedule_timeout_killable(HZ / 10))
>
> 100 msec seems like a long time to wait.  The original code in shrink_inactive_list
> choose 100 msec sleep because the sleep happens only once in the while loop and 100 msec was
> used to check for stalling.  In this case the loop can go on for a while and the
> #reclaimers can go down below the sooner than 100 msec. Seems like it should be checked
> more often.

You are not looking at the original code -- the original code sleeps
indefinitely. It was changed by commit db73ee0d46 to fix a problem
that doesn't apply to the code above.

HZ/10 is purely arbitrary but that's ok because we assume normally
nobody hits it. If you do often, we need to figure out why and how not
to hit it so often.

  reply	other threads:[~2021-04-22 20:30 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-16  2:35 [RFC] mm/vmscan.c: avoid possible long latency caused by too_many_isolated() zhengjun.xing
2021-04-22  8:36 ` Xing Zhengjun
2021-04-22 17:13   ` Yu Zhao
2021-04-22 18:51     ` Shakeel Butt
2021-04-22 20:15       ` Yu Zhao
2021-04-22 20:17     ` Tim Chen
2021-04-22 20:30       ` Yu Zhao [this message]
2021-04-22 20:38         ` Tim Chen
2021-04-22 20:57           ` Yu Zhao
2021-04-22 21:02             ` Tim Chen
2021-04-23  6:57     ` Xing Zhengjun
2021-04-23 20:23       ` Yu Zhao
2021-04-25  0:48         ` Huang, Ying
2021-04-27 21:53           ` Yu Zhao
2021-04-30  5:57         ` Xing Zhengjun
2021-04-30  6:24           ` Yu Zhao
2021-04-28 11:55     ` Michal Hocko
2021-04-28 15:05       ` Yu Zhao
2021-04-29 10:00         ` Michal Hocko
2021-04-30  8:34           ` Yu Zhao
2021-04-30  9:17             ` Michal Hocko
2021-04-30 17:04               ` Yu Zhao
     [not found] ` <20210422102325.1332-1-hdanton@sina.com>
2021-04-23  6:55   ` Xing Zhengjun
2021-04-30  5:33   ` Xing Zhengjun
     [not found]   ` <20210430064319.2189-1-hdanton@sina.com>
2021-05-10  8:03     ` Xing Zhengjun

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=CAOUHufbVmsvWQ-_PSn8CCanuJqRR6Tmj01s17WvKsc3pRa87xw@mail.gmail.com \
    --to=yuzhao@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    --cc=shakeelb@google.com \
    --cc=tim.c.chen@linux.intel.com \
    --cc=wfg@mail.ustc.edu.cn \
    --cc=ying.huang@intel.com \
    --cc=zhengjun.xing@linux.intel.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;
as well as URLs for NNTP newsgroup(s).