linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Hannes Reinecke <hare@suse.de>
Cc: Pankaj Raghav <p.raghav@samsung.com>,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	mcgrof@kernel.org
Subject: Re: [PATCH] mm/filemap: allocate folios according to the blocksize
Date: Sun, 16 Apr 2023 05:00:56 +0100	[thread overview]
Message-ID: <ZDty+PQfHkrGBojn@casper.infradead.org> (raw)
In-Reply-To: <20230414134908.103932-1-hare@suse.de>

On Fri, Apr 14, 2023 at 03:49:08PM +0200, Hannes Reinecke wrote:
> @@ -3607,14 +3611,16 @@ static struct folio *do_read_cache_folio(struct address_space *mapping,
>  		pgoff_t index, filler_t filler, struct file *file, gfp_t gfp)
>  {
>  	struct folio *folio;
> -	int err;
> +	int err, order = 0;
>  
> +	if (mapping->host->i_blkbits > PAGE_SHIFT)
> +		order = mapping->host->i_blkbits - PAGE_SHIFT;

This pattern comes up a few times.  What I did in a patch I wrote back
in December 2020 and never submitted (!) was this:


@@ -198,9 +198,15 @@ enum mapping_flags {
        AS_EXITING      = 4,    /* final truncate in progress */
        /* writeback related tags are not used */
        AS_NO_WRITEBACK_TAGS = 5,
-       AS_LARGE_FOLIO_SUPPORT = 6,
+       AS_FOLIO_ORDER_MIN = 8,
+       AS_FOLIO_ORDER_MAX = 13,
+       /* 8-17 are used for FOLIO_ORDER */
 };

+#define AS_FOLIO_ORDER_MIN_MASK        0x00001f00
+#define AS_FOLIO_ORDER_MAX_MASK 0x0002e000
+#define AS_FOLIO_ORDER_MASK (AS_FOLIO_ORDER_MIN_MASK | AS_FOLIO_ORDER_MAX_MASK)

...

+static inline unsigned mapping_min_folio_order(struct address_space *mapping)
+{
+	return (mapping->flags & AS_FOLIO_ORDER_MIN_MASK) >> AS_FOLIO_ORDER_MIN;
+}

(do we really need 5 bits for each, or can we get by with eg 3 or 4 bits?)

Anyway, the point is that we could set this quite early in the creation
of the mapping, and eliminate the conditional setting of order.

  parent reply	other threads:[~2023-04-16  4:01 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20230414134914eucas1p1f0b08409dce8bc946057d0a4fa7f1601@eucas1p1.samsung.com>
2023-04-14 13:49 ` [PATCH] mm/filemap: allocate folios according to the blocksize Hannes Reinecke
2023-04-14 13:56   ` Matthew Wilcox
2023-04-16  4:00   ` Matthew Wilcox [this message]
2023-04-17  2:18   ` kernel test robot
2023-04-17  4:10     ` Matthew Wilcox
2023-04-17  4:36   ` Christoph Hellwig
2023-04-17  6:08     ` Hannes Reinecke
2023-04-17  6:27       ` Christoph Hellwig
2023-04-17  6:30         ` Hannes Reinecke
2023-04-20 12:05   ` Pankaj Raghav
2023-04-20 12:19     ` Hannes Reinecke
2023-04-20 12:28       ` Pankaj Raghav
2023-04-20 15:03         ` Darrick J. Wong
2023-04-22  0:14           ` Dave Chinner

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=ZDty+PQfHkrGBojn@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=hare@suse.de \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mcgrof@kernel.org \
    --cc=p.raghav@samsung.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;
as well as URLs for NNTP newsgroup(s).