linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Suren Baghdasaryan <surenb@google.com>
Cc: akpm@linux-foundation.org, david@redhat.com,
	lorenzo.stoakes@oracle.com, Liam.Howlett@oracle.com,
	vbabka@suse.cz, alexandru.elisei@arm.com, peterx@redhat.com,
	sj@kernel.org, rppt@kernel.org, mhocko@suse.com, corbet@lwn.net,
	axboe@kernel.dk, viro@zeniv.linux.org.uk, brauner@kernel.org,
	hch@infradead.org, jack@suse.cz, m.szyprowski@samsung.com,
	robin.murphy@arm.com, hannes@cmpxchg.org,
	zhengqi.arch@bytedance.com, shakeel.butt@linux.dev,
	axelrasmussen@google.com, yuanchu@google.com, weixugc@google.com,
	minchan@kernel.org, linux-mm@kvack.org,
	linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	iommu@lists.linux.dev, Minchan Kim <minchan@google.com>
Subject: Re: [PATCH 1/8] mm: implement cleancache
Date: Fri, 10 Oct 2025 03:39:49 +0100	[thread overview]
Message-ID: <aOhx9Zj1a6feN8wC@casper.infradead.org> (raw)
In-Reply-To: <20251010011951.2136980-2-surenb@google.com>

On Thu, Oct 09, 2025 at 06:19:44PM -0700, Suren Baghdasaryan wrote:
> +	/*
> +	 * 99% of the time, we don't need to flush the cleancache on the bdev.
> +	 * But, for the strange corners, lets be cautious
> +	 */
> +	cleancache_invalidate_inode(mapping, mapping->host);

Why do we need to pass in both address_space and inode?

> +/*
> + * Backend API
> + *
> + * Cleancache does not touch page reference. Page refcount should be 1 when
> + * page is placed or returned into cleancache and pages obtained from
> + * cleancache will also have their refcount at 1.

I don't like these references to page refcount.  Surely you mean folio
refcount?

> +	help
> +	  Cleancache can be thought of as a page-granularity victim cache
> +	  for clean pages that the kernel's pageframe replacement algorithm
> +	  (PFRA) would like to keep around, but can't since there isn't enough

PFRA seems to be an acronym you've just made up.  Why?

> +struct cleancache_inode {
> +	struct inode *inode;
> +	struct hlist_node hash;
> +	refcount_t ref_count;
> +	struct xarray folios; /* protected by folios.xa_lock */

This is a pointless comment.  All xarrays are protected by their own
xa_lock.

> +static DEFINE_IDR(fs_idr);

No.  The IDR is deprecated.  Use an allocating XArray.

> +/*
> + * Folio attributes:
> + *	folio->_mapcount - pool_id
> + *	folio->mapping - ccinode reference or NULL if folio is unused
> + *	folio->index - file offset

No.  Don't reuse fields for something entirely different.  Put a
properly named field in the union.

> +static void folio_attachment(struct folio *folio, struct cleancache_inode **ccinode,

Unnecessarily long line



  parent reply	other threads:[~2025-10-10  2:40 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-10  1:19 [PATCH 0/8] Guaranteed CMA Suren Baghdasaryan
2025-10-10  1:19 ` [PATCH 1/8] mm: implement cleancache Suren Baghdasaryan
2025-10-10  1:31   ` Andrew Morton
2025-10-10  1:42     ` Suren Baghdasaryan
2025-10-10  2:39   ` Matthew Wilcox [this message]
2025-10-10 14:53     ` Suren Baghdasaryan
2025-10-10 21:17   ` kernel test robot
2025-10-10 21:42     ` Suren Baghdasaryan
2025-10-13  6:44   ` Christoph Hellwig
2025-10-13 15:43     ` Suren Baghdasaryan
2025-10-10  1:19 ` [PATCH 2/8] mm/cleancache: add cleancache LRU for folio aging Suren Baghdasaryan
2025-10-10  1:19 ` [PATCH 3/8] mm/cleancache: readahead support Suren Baghdasaryan
2025-10-10  1:19 ` [PATCH 4/8] mm/cleancache: add sysfs interface Suren Baghdasaryan
2025-10-10  1:19 ` [PATCH 5/8] mm/tests: add cleancache kunit test Suren Baghdasaryan
2025-10-11  2:57   ` kernel test robot
2025-10-11 21:47     ` Suren Baghdasaryan
2025-10-10  1:19 ` [PATCH 6/8] add cleancache documentation Suren Baghdasaryan
2025-10-10 20:20   ` SeongJae Park
2025-10-10 22:09     ` Suren Baghdasaryan
2025-10-10  1:19 ` [PATCH 7/8] mm: introduce GCMA Suren Baghdasaryan
2025-10-10 21:11   ` SeongJae Park
2025-10-10 22:05     ` Suren Baghdasaryan
2025-10-10  1:19 ` [PATCH 8/8] mm: integrate GCMA with CMA using dt-bindings 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=aOhx9Zj1a6feN8wC@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=Liam.Howlett@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=alexandru.elisei@arm.com \
    --cc=axboe@kernel.dk \
    --cc=axelrasmussen@google.com \
    --cc=brauner@kernel.org \
    --cc=corbet@lwn.net \
    --cc=david@redhat.com \
    --cc=hannes@cmpxchg.org \
    --cc=hch@infradead.org \
    --cc=iommu@lists.linux.dev \
    --cc=jack@suse.cz \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lorenzo.stoakes@oracle.com \
    --cc=m.szyprowski@samsung.com \
    --cc=mhocko@suse.com \
    --cc=minchan@google.com \
    --cc=minchan@kernel.org \
    --cc=peterx@redhat.com \
    --cc=robin.murphy@arm.com \
    --cc=rppt@kernel.org \
    --cc=shakeel.butt@linux.dev \
    --cc=sj@kernel.org \
    --cc=surenb@google.com \
    --cc=vbabka@suse.cz \
    --cc=viro@zeniv.linux.org.uk \
    --cc=weixugc@google.com \
    --cc=yuanchu@google.com \
    --cc=zhengqi.arch@bytedance.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