linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Mel Gorman <mgorman@techsingularity.net>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Yafang Shao <laoar.shao@gmail.com>,
	linux-mm@kvack.org, Matthew Wilcox <willy@infradead.org>,
	David Rientjes <rientjes@google.com>,
	"Huang, Ying" <ying.huang@intel.com>
Subject: Re: [PATCH] mm: Enable setting -1 for vm.percpu_pagelist_high_fraction to set the minimum pagelist
Date: Fri, 5 Jul 2024 14:09:43 +0100	[thread overview]
Message-ID: <20240705130943.htsyhhhzbcptnkcu@techsingularity.net> (raw)
In-Reply-To: <20240701195143.7e8d597abc14b255f3bc4bcd@linux-foundation.org>

On Mon, Jul 01, 2024 at 07:51:43PM -0700, Andrew Morton wrote:
> On Mon,  1 Jul 2024 22:20:46 +0800 Yafang Shao <laoar.shao@gmail.com> wrote:
> 
> > Currently, we're encountering latency spikes in our container environment
> > when a specific container with multiple Python-based tasks exits. These
> > tasks may hold the zone->lock for an extended period, significantly
> > impacting latency for other containers attempting to allocate memory.
> 
> Is this locking issue well understood? 

I cannot comment about others but I believe this problem to be
well-understood. The zone->lock is an incredibly large lock at this point
protecting an unbounded amount of data. As time goes by, it's just getting
worse and it was terrible even a few years ago, let alone now.

> Is anyone working on it? 

Not that I'm aware of but I've paid so little attention to linux-mm in
the last few years, that's not saying much.

The main problem is that it's hard to solve quickly as splitting that
lock is possible, but not trivial.  I am mildly concerned that more and
more people are looking for ways of getting around zone->lock contention
using the PCP allocator. I believe that to be a losing battle even though
I added THP to the PCP caching myself. Now we have dynamic resizing which
works ok but piling on top of it are file-backed THPs and THPs smaller than
MAX_ORDER, folios in general etc. Dealing with that within PCP has limits and
adding more sysctls to deal with corner cases is a band-aid that most users
probably will miss. Working around all the zone->lock issues in PCP just
delays the inevitable as PCP doesn't play well with overall availability
(e.g. high order pages free but on a remote CPU), fragmentation control
(frag fallback because desired page type are on a remote CPU) or scaling
(because ultimately it can still contend on zone->lock). IIUC, pcp lists
were originally about preserving cache hotness with zone->lock contention
reduction as a bonus but now it's a band aid trying to deal with for
zone->lock covering massive amounts of memory.

Eventually the work will have to be put into splitting zone lock using
something akin to memory arenas and moving away from zone_id to identify
what range of free lists a particular page belongs to.

-- 
Mel Gorman
SUSE Labs


  parent reply	other threads:[~2024-07-05 13:09 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-01 14:20 Yafang Shao
2024-07-02  2:51 ` Andrew Morton
2024-07-02  6:37   ` Yafang Shao
2024-07-02  9:08     ` Huang, Ying
2024-07-02 12:07       ` Yafang Shao
2024-07-03  1:55         ` Huang, Ying
2024-07-03  2:13           ` Yafang Shao
2024-07-03  3:21             ` Huang, Ying
2024-07-03  3:44               ` Yafang Shao
2024-07-03  5:34                 ` Huang, Ying
2024-07-04 13:27                   ` Yafang Shao
2024-07-05  1:28                     ` Huang, Ying
2024-07-05  3:03                       ` Yafang Shao
2024-07-05  5:31                         ` Huang, Ying
2024-07-05 13:09   ` Mel Gorman [this message]
2024-07-02  7:23 ` Huang, Ying

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=20240705130943.htsyhhhzbcptnkcu@techsingularity.net \
    --to=mgorman@techsingularity.net \
    --cc=akpm@linux-foundation.org \
    --cc=laoar.shao@gmail.com \
    --cc=linux-mm@kvack.org \
    --cc=rientjes@google.com \
    --cc=willy@infradead.org \
    --cc=ying.huang@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