lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Sun, 16 Apr 2023 05:00:56 +0100
From:   Matthew Wilcox <willy@...radead.org>
To:     Hannes Reinecke <hare@...e.de>
Cc:     Pankaj Raghav <p.raghav@...sung.com>,
        linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
        mcgrof@...nel.org
Subject: Re: [PATCH] mm/filemap: allocate folios according to the blocksize

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.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ