From: Matthew Wilcox <willy@infradead.org>
To: Michal Hocko <mhocko@suse.com>
Cc: Hao Lee <haolee.swjtu@gmail.com>, Linux MM <linux-mm@kvack.org>,
Johannes Weiner <hannes@cmpxchg.org>,
vdavydov.dev@gmail.com, Shakeel Butt <shakeelb@google.com>,
cgroups@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] mm: reduce spinlock contention in release_pages()
Date: Mon, 29 Nov 2021 13:23:19 +0000 [thread overview]
Message-ID: <YaTUR9WcGoOG4oLo@casper.infradead.org> (raw)
In-Reply-To: <YaSRtKwTCOj7JnR6@dhcp22.suse.cz>
On Mon, Nov 29, 2021 at 09:39:16AM +0100, Michal Hocko wrote:
> On Fri 26-11-21 16:26:23, Hao Lee wrote:
> [...]
> > I will try Matthew's idea to use semaphore or mutex to limit the number of BE
> > jobs that are in the exiting path. This sounds like a feasible approach for
> > our scenario...
>
> I am not really sure this is something that would be acceptable. Your
> problem is resource partitioning. Papering that over by a lock is not
> the right way to go. Besides that you will likely hit a hard question on
> how many tasks to allow to run concurrently. Whatever the value some
> workload will very likely going to suffer. We cannot assume admin to
> chose the right value because there is no clear answer for that. Not to
> mention other potential problems - e.g. even more priority inversions
> etc.
I don't see how we get priority inversions. These tasks are exiting; at
the point they take the semaphore, they should not be holding any locks.
They're holding a resource (memory) that needs to be released, but a
task wanting to acquire memory must already be prepared to sleep.
I see this as being a thundering herd problem. We have dozens, maybe
hundreds of tasks all trying to free their memory at once. If we force
the herd to go through a narrow gap, they arrive at the spinlock in an
orderly manner.
next prev parent reply other threads:[~2021-11-29 13:23 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-24 15:19 Hao Lee
2021-11-24 15:57 ` Matthew Wilcox
2021-11-25 3:13 ` Hao Lee
2021-11-24 16:31 ` Michal Hocko
2021-11-25 3:24 ` Hao Lee
2021-11-25 3:30 ` Matthew Wilcox
2021-11-25 8:02 ` Hao Lee
2021-11-25 10:01 ` Michal Hocko
2021-11-25 12:31 ` Hao Lee
2021-11-25 14:18 ` Michal Hocko
2021-11-26 6:50 ` Hao Lee
2021-11-26 10:46 ` Michal Hocko
2021-11-26 16:26 ` Hao Lee
2021-11-29 8:39 ` Michal Hocko
2021-11-29 13:23 ` Matthew Wilcox [this message]
2021-11-29 13:39 ` Michal Hocko
2021-11-25 18:04 ` Matthew Wilcox
2021-11-26 6:54 ` Hao Lee
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=YaTUR9WcGoOG4oLo@casper.infradead.org \
--to=willy@infradead.org \
--cc=cgroups@vger.kernel.org \
--cc=hannes@cmpxchg.org \
--cc=haolee.swjtu@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.com \
--cc=shakeelb@google.com \
--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