public inbox for linux-mm@kvack.org
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: Harry Yoo <harry.yoo@oracle.com>
Cc: Jann Horn <jannh@google.com>, Christoph Lameter <cl@linux.com>,
	David Rientjes <rientjes@google.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Roman Gushchin <roman.gushchin@linux.dev>,
	"Tobin C. Harding" <tobin@kernel.org>,
	Alexander Viro <viro@zeniv.linux.org.uk>,
	Matthew Wilcox <willy@infradead.org>,
	Vlastimil Babka <vbabka@suse.cz>, Rik van Riel <riel@surriel.com>,
	Andrea Arcangeli <aarcange@redhat.com>,
	"Liam R. Howlett" <Liam.Howlett@oracle.com>,
	Lorenzo Stoakes <lorenzo.stoakes@oracle.com>,
	Pedro Falcato <pfalcato@suse.de>,
	David Hildenbrand <david@redhat.com>,
	Oscar Salvador <osalvador@suse.de>,
	Michal Hocko <mhocko@kernel.org>,
	Byungchul Park <byungchul@sk.com>,
	linux-mm@kvack.org, linux-fsdevel@vger.kernel.org
Subject: Re: [DISCUSSION] Revisiting Slab Movable Objects
Date: Tue, 6 May 2025 09:29:23 +1000	[thread overview]
Message-ID: <aBlJ0yhsCTTh9svQ@dread.disaster.area> (raw)
In-Reply-To: <aBIhen0HXGgQf_d5@harry>

On Wed, Apr 30, 2025 at 10:11:22PM +0900, Harry Yoo wrote:
> A more general question: will either shattering or allocating
> smaller slabs help free more memory anyway?

In general, no.

> It likely depends on
> the spatial pattern of how the objects are reclaimed and remain
> populated within a slab?

Right - the pattern of inode/dentry residency in slab pages is
defined by temporal access patterns of any given inode/dentry. If an
application creates a new file and then holds it open, then that
slab page is pinned in memory until the application closes that
file.

Hence if we mix short term file accesses (e.g. access once files (like
updatedb) or short term temp files (like object files during a
code build) with long term open files, the slabs get fragmented
because of the few pinned long term objects in each slab page.

IOWs, the moment we start mixing objects with different temporal
access patterns within a single slab page during rapid cache growth,
we will get fragmentation of the cache as reclaim only removes the
short term objects during subsequent rapid cache shrinkage....

The unsolvable problem here is that we do not know (and cannot know)
what the life time of the object is going to be at object
instantiation time (i.e. path lookup). Hence the temporal access
patterns of objects in the slab pages are going to be largely
random. Experience tells me that even single page slabs (old skool
SLAB cache) had these fragmentation problems (esp. with dentries)
because even a 20:1 ratio of short:long term accesses will leave a
single long term dentry per 4kB slab backing page...

Hence using smaller slabs and/or shattering larger slabs isn't
likely to have all that much impact on the fragmentation of the
slabs because it doesn't do anything to solve the underlying object
lifetime interleaving that causes the fragmentation in the first
place...

-Dave.
-- 
Dave Chinner
david@fromorbit.com


  parent reply	other threads:[~2025-05-05 23:29 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-21 13:47 [DISCUSSION] Revisiting Slab Movable Objects Harry Yoo
2025-04-21 16:33 ` Pedro Falcato
2025-04-22 23:17   ` Harry Yoo
2025-04-23  5:53   ` Christoph Lameter (Ampere)
2025-04-21 21:54 ` Dave Chinner
2025-04-23  1:47   ` Al Viro
2025-04-23  7:20     ` Harry Yoo
2025-04-23  7:40       ` Al Viro
2025-04-25 11:09   ` Harry Yoo
2025-04-28 15:31     ` Jann Horn
2025-04-30 13:11       ` Harry Yoo
2025-04-30 22:23         ` Jann Horn
2025-05-05 23:29         ` Dave Chinner [this message]
2025-04-21 21:59 ` Tobin C. Harding

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=aBlJ0yhsCTTh9svQ@dread.disaster.area \
    --to=david@fromorbit.com \
    --cc=Liam.Howlett@oracle.com \
    --cc=aarcange@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=byungchul@sk.com \
    --cc=cl@linux.com \
    --cc=david@redhat.com \
    --cc=harry.yoo@oracle.com \
    --cc=jannh@google.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lorenzo.stoakes@oracle.com \
    --cc=mhocko@kernel.org \
    --cc=osalvador@suse.de \
    --cc=pfalcato@suse.de \
    --cc=riel@surriel.com \
    --cc=rientjes@google.com \
    --cc=roman.gushchin@linux.dev \
    --cc=tobin@kernel.org \
    --cc=vbabka@suse.cz \
    --cc=viro@zeniv.linux.org.uk \
    --cc=willy@infradead.org \
    /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