From patchwork Wed Dec 18 15:46:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kemeng Shi X-Patchwork-Id: 13913107 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id CBC35E77187 for ; Wed, 18 Dec 2024 06:48:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 480C66B0093; Wed, 18 Dec 2024 01:48:18 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 300DA6B009A; Wed, 18 Dec 2024 01:48:18 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1772A6B0098; Wed, 18 Dec 2024 01:48:18 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id DA8AC6B0092 for ; Wed, 18 Dec 2024 01:48:17 -0500 (EST) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 9813EC0BEF for ; Wed, 18 Dec 2024 06:48:17 +0000 (UTC) X-FDA: 82907148408.20.2EBAE3A Received: from dggsgout12.his.huawei.com (dggsgout12.his.huawei.com [45.249.212.56]) by imf16.hostedemail.com (Postfix) with ESMTP id 57DB5180006 for ; Wed, 18 Dec 2024 06:47:40 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf16.hostedemail.com: domain of shikemeng@huaweicloud.com designates 45.249.212.56 as permitted sender) smtp.mailfrom=shikemeng@huaweicloud.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1734504466; a=rsa-sha256; cv=none; b=U8/9/AiBFyecCfOxSsiIt0hXVO7nT0SGXAJiFigezerRRJfOwneOC4NFCPJbAya4HQugqp 4/TYQU6Y9HUG00/KQcvY++kj8HR76hMMKl5d0viWr6Zfo+p2vxCGuDFGx7dgHdV93sGY1P ozE2+0ZF16p1+11dnyqsAC8B40ufj4E= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf16.hostedemail.com: domain of shikemeng@huaweicloud.com designates 45.249.212.56 as permitted sender) smtp.mailfrom=shikemeng@huaweicloud.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1734504466; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Z4BbOlZEkt/W5xNHqln4dcqe6CQrwVZO/98XAp4h3Sw=; b=j6eJW348WQkLEvuj+4zWMW89LHNnxWJmi9ut0jSmJ0igshz+cTgKA+pDu5KrR+NDaJetdf 5JX5WE2N9Iyr1iZWY/AklN1ajBvdE3vbRW2yVM4qs5oV710lqOhFevUg0Ci2GRLEXq3UgG e9lrS/nwGIEDu+TPqtGA60UDkLLmOJ8= Received: from mail.maildlp.com (unknown [172.19.93.142]) by dggsgout12.his.huawei.com (SkyGuard) with ESMTP id 4YCkl91nbGz4f3jMt for ; Wed, 18 Dec 2024 14:47:49 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.112]) by mail.maildlp.com (Postfix) with ESMTP id B958C1A018D for ; Wed, 18 Dec 2024 14:48:08 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.101.6]) by APP1 (Coremail) with SMTP id cCh0CgA33a4mcGJnxKU7Ew--.4083S5; Wed, 18 Dec 2024 14:48:08 +0800 (CST) From: Kemeng Shi To: akpm@linux-foundation.org, willy@infradead.org Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-nfs@vger.kernel.org Subject: [PATCH v4 3/5] Xarray: distinguish large entries correctly in xas_split_alloc() Date: Wed, 18 Dec 2024 23:46:11 +0800 Message-Id: <20241218154613.58754-4-shikemeng@huaweicloud.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20241218154613.58754-1-shikemeng@huaweicloud.com> References: <20241218154613.58754-1-shikemeng@huaweicloud.com> MIME-Version: 1.0 X-CM-TRANSID: cCh0CgA33a4mcGJnxKU7Ew--.4083S5 X-Coremail-Antispam: 1UD129KBjvdXoW7GF1rGr4kJF1DCr4DJw1fZwb_yoWDurg_ur 4FgF4kZr45GF4kXwnxCF4rt340kFn0kF9ruFWUJr9xW34UJrsrtr1kWrsrXa4rAFyjyFy7 AFs5Jry093yUKjkaLaAFLSUrUUUUjb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUIcSsGvfJTRUUUbDAYFVCjjxCrM7AC8VAFwI0_Wr0E3s1l1xkIjI8I6I8E6xAIw20E Y4v20xvaj40_Wr0E3s1l1IIY67AEw4v_Jr0_Jr4l87I20VAvwVAaII0Ic2I_JFv_Gryl82 xGYIkIc2x26280x7IE14v26r1rM28IrcIa0xkI8VCY1x0267AKxVW8JVW5JwA2ocxC64kI II0Yj41l84x0c7CEw4AK67xGY2AK021l84ACjcxK6xIIjxv20xvE14v26F1j6w1UM28EF7 xvwVC0I7IYx2IY6xkF7I0E14v26r4UJVWxJr1l84ACjcxK6I8E87Iv67AKxVW0oVCq3wA2 z4x0Y4vEx4A2jsIEc7CjxVAFwI0_GcCE3s1le2I262IYc4CY6c8Ij28IcVAaY2xG8wAqx4 xG64xvF2IEw4CE5I8CrVC2j2WlYx0E2Ix0cI8IcVAFwI0_Jr0_Jr4lYx0Ex4A2jsIE14v2 6r1j6r4UMcvjeVCFs4IE7xkEbVWUJVW8JwACjcxG0xvY0x0EwIxGrwCY1x0262kKe7AKxV WUAVWUtwCF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F40E 14v26r1j6r18MI8I3I0E7480Y4vE14v26r106r1rMI8E67AF67kF1VAFwI0_JF0_Jw1lIx kGc2Ij64vIr41lIxAIcVC0I7IYx2IY67AKxVWUJVWUCwCI42IY6xIIjxv20xvEc7CjxVAF wI0_Gr0_Cr1lIxAIcVCF04k26cxKx2IYs7xG6r1j6r1xMIIF0xvEx4A2jsIE14v26r1j6r 4UMIIF0xvEx4A2jsIEc7CjxVAFwI0_Gr0_Gr1UYxBIdaVFxhVjvjDU0xZFpf9x07jvUDXU UUUU= X-CM-SenderInfo: 5vklyvpphqwq5kxd4v5lfo033gof0z/ X-Stat-Signature: re558f68i5iu31sxnwu3rnf4dbnqgy8n X-Rspam-User: X-Rspamd-Queue-Id: 57DB5180006 X-Rspamd-Server: rspam08 X-HE-Tag: 1734504460-398136 X-HE-Meta: U2FsdGVkX19z9r7EuFDHSFYxEemJgaKhXzA3ADo0h/TeY8LzQsoRoCpehqUOLfTQsK/VGrnrTj+UijbiWfwcb4jBjwYdYCAr0kAHSVSmKzWt5QTfZIYezBjqNir4pxzfkXTzY6twgq+RQ49ZUNuCo1O+iFEdvBOZuiiARIWrEbYSeol/w9R172QsDdBY4LxS9+1G1FK1JdOATgTyiPgGEbtSMkifxxuQY6iMnomoA1894cziz1Qk4cri7M5T9mPhkNch4yhIY7gOEF1WKoiLRnNFBZ+LEhozp8C7G9WM1vqgcC/5582atBfoSjSBoOeH8na51r42josrZBeBCPHTwtYVramLin240qteycdeEnDOPhZXjLK4dt/hv6d1+ChlCfMopEru9SdNG2LQesHJkNPdYPQHAi2prLGLkls2Q2QhPnGvuIsLxAzuW8Sncadidi/sNjAAdBm90Nd/x9UIaJB+TSwIijxSWHtWI9tQHZVor4DXcR1WriO3vP9w7NyJQCyN+Mjl41dQKNgnBARDhEnxe04C7RkXV9+aV5KroQWxsJ6ufDl2DW+FkrrUWfpVM3rJlichFN06Ogqw8eY6LX7Ymk/SUjb5HJlti9HP6Fu1j8SFG7tXsTgLfAH5B9vfjPd2db72otFa8uCqZuVzpqVMAwJvk3vu88iAjQT41VszgacirQax0PuABGpcc/Vpl0f24HgFZW/gtnKQpgQ35qtQtN2mfIyb+hpW9+HA/VxpAfUGxAlIxt7XWWN5Mi3mmjjw9TTQNdG9lLJ3y43nCa5VGTlmLEzUOM/rhlnh7k2ZgytGlypyUeLFjYY4gIRRKrVVIvSCzqK04DESHsSJcxs38s0xtxjvvpNIb4AGaNw9UqTch0G/Jd7eXL9k/s5E6PxX3KEVy/DKgW4ZK7HmakwFOi5VPT8TJVqFSWGySC9+uXrsWlB4gCuWE6uBSsY5/2OQjryiL5jhwsH3cL2 UTPUB5Mg hIPwYM03hXItrxnMXZYKq37GBdgVDBliTCT+w07K/CSZYjwmgdVnYasiXuSTF7CG7Q/WZAkDfeIoM1xIR2KNwww/dRHmQoTPh8EJjF8Pw2pROGnXNSFl4UjsYk6qjSVg3kn90NMWSx9+DvR3XLX1Hp4qB/VI2xbewZPvrUa3ia5LeZ2bNB7HxBZPy9s9Ee3rjabKhTfq9vx9C+xQNLMxNBf8g2g== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: 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... Signed-off-by: Kemeng Shi --- lib/xarray.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/xarray.c b/lib/xarray.c index d0732c5b8403..3fac3f2cea9d 100644 --- a/lib/xarray.c +++ b/lib/xarray.c @@ -1022,7 +1022,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;