]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
Xarray: distinguish large entries correctly in xas_split_alloc()
authorKemeng Shi <shikemeng@huaweicloud.com>
Fri, 13 Dec 2024 12:25:21 +0000 (20:25 +0800)
committerAndrew Morton <akpm@linux-foundation.org>
Sat, 25 Jan 2025 06:47:27 +0000 (22:47 -0800)
We don't support large entries which expand two more level xa_node in
split.  For case "xas->xa_shift + 2 * XA_CHUNK_SHIFT == order", we also
need two level of xa_node to expand.  Distinguish entry as large entry in
case "xas->xa_shift + 2 * XA_CHUNK_SHIFT == order".

As max order of folio in pagecache (MAX_PAGECACHE_ORDER) is <=
(XA_CHUNK_SHIFT * 2 - 1), this change is more likely a cleanup...

Link: https://lkml.kernel.org/r/20241213122523.12764-4-shikemeng@huaweicloud.com
Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com>
Cc: Mattew Wilcox <willy@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
lib/xarray.c

index 091e2c927915a517dc9b7ae3585530ba42ef08e4..ecd2e4f71aa86d667d24cab3bcd62ff844dbef6d 100644 (file)
@@ -1027,7 +1027,7 @@ void xas_split_alloc(struct xa_state *xas, void *entry, unsigned int order,
        unsigned int mask = xas->xa_sibs;
 
        /* XXX: no support for splitting really large entries yet */
-       if (WARN_ON(xas->xa_shift + 2 * XA_CHUNK_SHIFT < order))
+       if (WARN_ON(xas->xa_shift + 2 * XA_CHUNK_SHIFT <= order))
                goto nomem;
        if (xas->xa_shift + XA_CHUNK_SHIFT > order)
                return;