linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Suren Baghdasaryan <surenb@google.com>
To: Michal Hocko <mhocko@suse.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Johannes Weiner <hannes@cmpxchg.org>,
	 Petr Mladek <pmladek@suse.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Roman Gushchin <guro@fb.com>,  Shakeel Butt <shakeelb@google.com>,
	Minchan Kim <minchan@kernel.org>,
	 Tim Murray <timmurray@google.com>, linux-mm <linux-mm@kvack.org>,
	 LKML <linux-kernel@vger.kernel.org>,
	kernel-team <kernel-team@android.com>
Subject: Re: [RFC 1/1] mm: page_alloc: replace mm_percpu_wq with kthreads in drain_all_pages
Date: Mon, 7 Mar 2022 09:24:37 -0800	[thread overview]
Message-ID: <CAJuCfpEt6V+v_FcLsYWpGLA1vwCK01vv0PqNernfKM2GTzNqKg@mail.gmail.com> (raw)
In-Reply-To: <YiY7K4ftAI3t6km8@dhcp22.suse.cz>

On Mon, Mar 7, 2022 at 9:04 AM 'Michal Hocko' via kernel-team
<kernel-team@android.com> wrote:
>
> On Thu 24-02-22 17:28:19, Suren Baghdasaryan wrote:
> > Sending as an RFC to confirm if this is the right direction and to
> > clarify if other tasks currently executed on mm_percpu_wq should be
> > also moved to kthreads. The patch seems stable in testing but I want
> > to collect more performance data before submitting a non-RFC version.
> >
> >
> > Currently drain_all_pages uses mm_percpu_wq to drain pages from pcp
> > list during direct reclaim. The tasks on a workqueue can be delayed
> > by other tasks in the workqueues using the same per-cpu worker pool.
> > This results in sizable delays in drain_all_pages when cpus are highly
> > contended.
>
> This is not about cpus being highly contended. It is about too much work
> on the WQ context.

Ack.

>
> > Memory management operations designed to relieve memory pressure should
> > not be allowed to block by other tasks, especially if the task in direct
> > reclaim has higher priority than the blocking tasks.
>
> Agreed here.
>
> > Replace the usage of mm_percpu_wq with per-cpu low priority FIFO
> > kthreads to execute draining tasks.
>
> This looks like a natural thing to do when WQ context is not suitable
> but I am not sure the additional resources is really justified. Large
> machines with a lot of cpus would create a lot of kernel threads. Can we
> do better than that?
>
> Would it be possible to have fewer workers (e.g. 1 or one per numa node)
> and it would perform the work on a dedicated cpu by changing its
> affinity? Or would that introduce an unacceptable overhead?

Not sure but I can try implementing per-node kthreads and measure the
performance of the reclaim path, comparing with the current and with
per-cpu approach.

>
> Or would it be possible to update the existing WQ code to use rescuer
> well before the WQ is completely clogged?
> --
> Michal Hocko
> SUSE Labs
>
> --
> To unsubscribe from this group and stop receiving emails from it, send an email to kernel-team+unsubscribe@android.com.
>


  reply	other threads:[~2022-03-07 17:24 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-25  1:28 Suren Baghdasaryan
2022-03-01 12:25 ` Petr Mladek
2022-03-01 21:12   ` Suren Baghdasaryan
2022-03-02 12:18     ` Petr Mladek
2022-03-02  0:21 ` Hillf Danton
2022-03-02 23:06   ` Suren Baghdasaryan
2022-03-07 16:35     ` Petr Mladek
2022-03-07 16:48       ` Suren Baghdasaryan
2022-03-07 17:04 ` Michal Hocko
2022-03-07 17:24   ` Suren Baghdasaryan [this message]
2022-03-17 23:04     ` Suren Baghdasaryan

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=CAJuCfpEt6V+v_FcLsYWpGLA1vwCK01vv0PqNernfKM2GTzNqKg@mail.gmail.com \
    --to=surenb@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=guro@fb.com \
    --cc=hannes@cmpxchg.org \
    --cc=kernel-team@android.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    --cc=minchan@kernel.org \
    --cc=peterz@infradead.org \
    --cc=pmladek@suse.com \
    --cc=shakeelb@google.com \
    --cc=timmurray@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