From patchwork Mon Feb 26 09:49:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Pankaj Raghav (Samsung)" X-Patchwork-Id: 13571759 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 39B6FC54E4A for ; Mon, 26 Feb 2024 09:49:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A715694001B; Mon, 26 Feb 2024 04:49:52 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A1FF7940014; Mon, 26 Feb 2024 04:49:52 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8E8C694001B; Mon, 26 Feb 2024 04:49:52 -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 7CD5A940014 for ; Mon, 26 Feb 2024 04:49:52 -0500 (EST) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 538A71A0712 for ; Mon, 26 Feb 2024 09:49:52 +0000 (UTC) X-FDA: 81833483424.19.3226749 Received: from mout-p-103.mailbox.org (mout-p-103.mailbox.org [80.241.56.161]) by imf13.hostedemail.com (Postfix) with ESMTP id B02B620005 for ; Mon, 26 Feb 2024 09:49:50 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=pankajraghav.com header.s=MBO0001 header.b=fFQkG18o; dmarc=none; spf=pass (imf13.hostedemail.com: domain of me@pankajraghav.com designates 80.241.56.161 as permitted sender) smtp.mailfrom=me@pankajraghav.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1708940991; 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:dkim-signature; bh=O82T73AIK6qGhlYorGzOupTzei7wEk6+FPA8o3URJUE=; b=L4N02r+8YFTkELH6lnQeT04sYkBDDu58rLPIaM+Ob1qcPrpXKvC2pf34v+DT2e8K1HQBl5 IUySYwePHkw+FZfBw07aChpx9ad4mkHLVfoYBeNHbtk+cUXCfK7P/SZuUjGkxqeY11RVbd 36EiKLK8N8htalvZ80Ci0COE6qcWm+o= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=pankajraghav.com header.s=MBO0001 header.b=fFQkG18o; dmarc=none; spf=pass (imf13.hostedemail.com: domain of me@pankajraghav.com designates 80.241.56.161 as permitted sender) smtp.mailfrom=me@pankajraghav.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1708940991; a=rsa-sha256; cv=none; b=e4sgu6pAmF+VgQ/TNOkAAwkTfLt5lGLhqBa1JxoktNRd40RkpGHRTnrqkdcQqa9lmDQnSf cerJdLaIXDZH9DmhpdaFEmX4r4jG0LMkH8J2mIE4folpXVtp63oQ+Zb6h+d19v9hLhbC2F J91xdsoLV1EBkNAL1/l6lCCJNQrqVM0= Received: from smtp202.mailbox.org (smtp202.mailbox.org [10.196.197.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-103.mailbox.org (Postfix) with ESMTPS id 4Tjwnk5kDgz9sT6; Mon, 26 Feb 2024 10:49:46 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pankajraghav.com; s=MBO0001; t=1708940986; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=O82T73AIK6qGhlYorGzOupTzei7wEk6+FPA8o3URJUE=; b=fFQkG18oqQYxyzAvUU/y6Xu/XNWxZbMy3Hto7NjxLMdpH4n7PnYGdCLyHr4oXKUWbXSdbt 3kIMgsOe+HNJi2CzUuOzIN8/o3Hwj48BF9JSpk1ELMgKLrxDpkLn7dQHexpKbAy6k3on3h tAY9LeXQaVX3Z0icnnr5KaXGnxzwdyT+lKKy4CYh251ECjLnS+cXrDxGEVm36OGNJwQwRd 47PB4v+rzOClutu21cDUGzMEc1J6st9TU1ML2CZo9yDdBjMu2qdfyN76b5tzCIv54RiQR8 MMZn9aLw+WeROCUn9RtgqMYpFq+RNdlieT4wk3ZhHKWPj+rdmiFDG5WMdnHFZg== From: "Pankaj Raghav (Samsung)" To: linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org Cc: linux-kernel@vger.kernel.org, david@fromorbit.com, chandan.babu@oracle.com, akpm@linux-foundation.org, mcgrof@kernel.org, ziy@nvidia.com, hare@suse.de, djwong@kernel.org, gost.dev@samsung.com, linux-mm@kvack.org, willy@infradead.org Subject: [PATCH 01/13] mm: Support order-1 folios in the page cache Date: Mon, 26 Feb 2024 10:49:24 +0100 Message-ID: <20240226094936.2677493-2-kernel@pankajraghav.com> In-Reply-To: <20240226094936.2677493-1-kernel@pankajraghav.com> References: <20240226094936.2677493-1-kernel@pankajraghav.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: B02B620005 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: deqgfj19bn87euc4gwow8k73d899jn6n X-HE-Tag: 1708940990-927624 X-HE-Meta: U2FsdGVkX18kpS1ghjqie/aFfJdaBaiAtYsLJ8qd/fhH+lVEiPve/eY2CxqlOlQqrGqL8aJOEDu6CkKDAZPpLV8aLz/h6vKcmhxA+JdorNJjYedHMc+EPhEKzDFW25/tqpDyH83nEyUn8fO0JMzqSbyIPW7wHR+UdsfjsyZNnk6Qu9D0tFbFRtbcF4pSgoJlnYO1p4ZGlBS4UhVEZO9kBFNPEJk/3bwpEHTSh53Un1I6+OVF353iqF8hd6+9SBnG/eyEFVMkrr1GlcuUU7d/kH4rIAn5HXtZAa0KxPhKbS/Qr0pJ4CMrPRtfOJykprl8tz3pxgVe6M5tMiWKdlMsGMl6qSqNBc4rQwYHjdp/YYqCqZJ/uuxhU9b3UArGkvHKco2qU+fJbnu6iUsxLxh30dNWkn4JoxjZD7eIb1Lmeelj58GcWiLS+m7fyOAeijp5PsxNLdLrOsVU4DSwsLmy+4WR4knsU/skHTb96VNTUeizEdrg+5Ye7frFi9kqhsbWMkscsj/6IoeEah/fg/FPictRgixdvj3FjIActNyuchsOQeLAXIZ310kjRGlNza+8QOUlEy2EhdWiScsXuIT309XXelTzKoGhnA/B7Z+fJQQ3jImF4G5eqiiciy2Fpi+7ioRaa58zP95IbOfT+CtN+aMCfbhxJyWEChQfBRXj78qZSPeAfSbdbskvdXYaaxqPby9h0TWzGu8cGbVtul15rA3B2zC4lHHaLQqStlGw+mYlxA6XGFaVGPU82O1cbMWWe4BLRd1HKaJeB3nmuN7NUAjVjT4Qv6tUlG6LqXH+/wP9p8kD0LPHAM7p9aqFbHMsofoOZ1vNeMeCkCRzqs2oEwtOXoQSqCr3QWxt3AH8NTiSpy1GfF/RyqXMb82VxjAgtR13gqBEqWnbqNsJ5wc8IhWSk1fiBnRKkSvuA7jVckOboorl4YSfwqwWWv5l9EZaH3elSG1Obfch+p+qWBL czdPQnmS VaA05/V5nH4tvp1PMSxWvez2GghhoVTQ+O+ZYjT2JQPMNKTpYQX65aEll7buhinnhLqv1 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: From: "Matthew Wilcox (Oracle)" Folios of order 1 have no space to store the deferred list. This is not a problem for the page cache as file-backed folios are never placed on the deferred list. All we need to do is prevent the core MM from touching the deferred list for order 1 folios and remove the code which prevented us from allocating order 1 folios. Link: https://lore.kernel.org/linux-mm/90344ea7-4eec-47ee-5996-0c22f42d6a6a@google.com/ Signed-off-by: Matthew Wilcox (Oracle) --- include/linux/huge_mm.h | 7 +++++-- mm/filemap.c | 2 -- mm/huge_memory.c | 23 ++++++++++++++++++----- mm/internal.h | 4 +--- mm/readahead.c | 3 --- 5 files changed, 24 insertions(+), 15 deletions(-) diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h index 5adb86af35fc..916a2a539517 100644 --- a/include/linux/huge_mm.h +++ b/include/linux/huge_mm.h @@ -263,7 +263,7 @@ unsigned long thp_vma_allowable_orders(struct vm_area_struct *vma, unsigned long thp_get_unmapped_area(struct file *filp, unsigned long addr, unsigned long len, unsigned long pgoff, unsigned long flags); -void folio_prep_large_rmappable(struct folio *folio); +struct folio *folio_prep_large_rmappable(struct folio *folio); bool can_split_folio(struct folio *folio, int *pextra_pins); int split_huge_page_to_list(struct page *page, struct list_head *list); static inline int split_huge_page(struct page *page) @@ -410,7 +410,10 @@ static inline unsigned long thp_vma_allowable_orders(struct vm_area_struct *vma, return 0; } -static inline void folio_prep_large_rmappable(struct folio *folio) {} +static inline struct folio *folio_prep_large_rmappable(struct folio *folio) +{ + return folio; +} #define transparent_hugepage_flags 0UL diff --git a/mm/filemap.c b/mm/filemap.c index 750e779c23db..2b00442b9d19 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -1912,8 +1912,6 @@ struct folio *__filemap_get_folio(struct address_space *mapping, pgoff_t index, gfp_t alloc_gfp = gfp; err = -ENOMEM; - if (order == 1) - order = 0; if (order > 0) alloc_gfp |= __GFP_NORETRY | __GFP_NOWARN; folio = filemap_alloc_folio(alloc_gfp, order); diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 94c958f7ebb5..81fd1ba57088 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -788,11 +788,15 @@ struct deferred_split *get_deferred_split_queue(struct folio *folio) } #endif -void folio_prep_large_rmappable(struct folio *folio) +struct folio *folio_prep_large_rmappable(struct folio *folio) { - VM_BUG_ON_FOLIO(folio_order(folio) < 2, folio); - INIT_LIST_HEAD(&folio->_deferred_list); + if (!folio || !folio_test_large(folio)) + return folio; + if (folio_order(folio) > 1) + INIT_LIST_HEAD(&folio->_deferred_list); folio_set_large_rmappable(folio); + + return folio; } static inline bool is_transparent_hugepage(struct folio *folio) @@ -3082,7 +3086,8 @@ int split_huge_page_to_list(struct page *page, struct list_head *list) /* Prevent deferred_split_scan() touching ->_refcount */ spin_lock(&ds_queue->split_queue_lock); if (folio_ref_freeze(folio, 1 + extra_pins)) { - if (!list_empty(&folio->_deferred_list)) { + if (folio_order(folio) > 1 && + !list_empty(&folio->_deferred_list)) { ds_queue->split_queue_len--; list_del(&folio->_deferred_list); } @@ -3133,6 +3138,9 @@ void folio_undo_large_rmappable(struct folio *folio) struct deferred_split *ds_queue; unsigned long flags; + if (folio_order(folio) <= 1) + return; + /* * At this point, there is no one trying to add the folio to * deferred_list. If folio is not in deferred_list, it's safe @@ -3158,7 +3166,12 @@ void deferred_split_folio(struct folio *folio) #endif unsigned long flags; - VM_BUG_ON_FOLIO(folio_order(folio) < 2, folio); + /* + * Order 1 folios have no space for a deferred list, but we also + * won't waste much memory by not adding them to the deferred list. + */ + if (folio_order(folio) <= 1) + return; /* * The try_to_unmap() in page reclaim path might reach here too, diff --git a/mm/internal.h b/mm/internal.h index f309a010d50f..5174b5b0c344 100644 --- a/mm/internal.h +++ b/mm/internal.h @@ -419,9 +419,7 @@ static inline struct folio *page_rmappable_folio(struct page *page) { struct folio *folio = (struct folio *)page; - if (folio && folio_order(folio) > 1) - folio_prep_large_rmappable(folio); - return folio; + return folio_prep_large_rmappable(folio); } static inline void prep_compound_head(struct page *page, unsigned int order) diff --git a/mm/readahead.c b/mm/readahead.c index 2648ec4f0494..369c70e2be42 100644 --- a/mm/readahead.c +++ b/mm/readahead.c @@ -516,9 +516,6 @@ void page_cache_ra_order(struct readahead_control *ractl, /* Don't allocate pages past EOF */ while (index + (1UL << order) - 1 > limit) order--; - /* THP machinery does not support order-1 */ - if (order == 1) - order = 0; err = ra_alloc_folio(ractl, index, mark, order, gfp); if (err) break; From patchwork Mon Feb 26 09:49:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Pankaj Raghav (Samsung)" X-Patchwork-Id: 13571760 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 A6A65C48BF6 for ; Mon, 26 Feb 2024 09:49:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2CFBD94001C; Mon, 26 Feb 2024 04:49:56 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 233EB940014; Mon, 26 Feb 2024 04:49:56 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0D23D94001C; Mon, 26 Feb 2024 04:49:56 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id EEF6D940014 for ; Mon, 26 Feb 2024 04:49:55 -0500 (EST) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id BCB1814071A for ; Mon, 26 Feb 2024 09:49:55 +0000 (UTC) X-FDA: 81833483550.30.D6CEB42 Received: from mout-p-101.mailbox.org (mout-p-101.mailbox.org [80.241.56.151]) by imf18.hostedemail.com (Postfix) with ESMTP id D4A1C1C0005 for ; Mon, 26 Feb 2024 09:49:53 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=pankajraghav.com header.s=MBO0001 header.b=eHLA+ySb; dmarc=none; spf=pass (imf18.hostedemail.com: domain of me@pankajraghav.com designates 80.241.56.151 as permitted sender) smtp.mailfrom=me@pankajraghav.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1708940994; 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:dkim-signature; bh=1cELEozXOYCd1Af2ZXfddDuv3Odm1CWuSBqyYDa15DQ=; b=vMF+YwiaTkO0YD5cFdhmEk0zhmt+i6VrgltlhMosxF9pgufekBGYkzdbFm41mnMSxxI2S+ Aoh5PInQS6feB7GQgPIoQOAv/QU+6MBHs4l0oBOC6vpCINvbx1va3hvdj34HQlLTxjdTzM TBUCe75C/kyjDall52P9d02ymPOlDD0= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=pankajraghav.com header.s=MBO0001 header.b=eHLA+ySb; dmarc=none; spf=pass (imf18.hostedemail.com: domain of me@pankajraghav.com designates 80.241.56.151 as permitted sender) smtp.mailfrom=me@pankajraghav.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1708940994; a=rsa-sha256; cv=none; b=NtgpEv+Nv6khnDhD+QuddrP7NbP6K1GQm8gx1TMWiFV4RTy6iwv7CSxyH9KF19LE6+1Rtp sBI6H/T/Hmjo+s6tlwE28xpiXmEtWvKkxHEF/cgho3yOw6MzXgayZCBo0XtWUjLnuz3tkP nQL/CIRP6gB+Fk0xkFgsJ8p3U0aiNw4= Received: from smtp102.mailbox.org (smtp102.mailbox.org [IPv6:2001:67c:2050:b231:465::102]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-101.mailbox.org (Postfix) with ESMTPS id 4Tjwnp4YR9z9sT0; Mon, 26 Feb 2024 10:49:50 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pankajraghav.com; s=MBO0001; t=1708940990; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1cELEozXOYCd1Af2ZXfddDuv3Odm1CWuSBqyYDa15DQ=; b=eHLA+ySb1gvVydfMakrzGixCW9UqE/O4JF8zTriGRt4EDHU0TwUfMWELwyC5HYIs9xEiwj PSpYl8DwDjWmjrhrpuSj6HhJyy76xEQLrXC5Rsk0BbNYX+RmkQI9K44Olivj0jne+3sQac 4nuD6fjSNjzNBIVfAOfRRhfuF9BFJzUIfwivK9VD2XPDve+6gVvsj+1n1e4WQHZZQs1W1l COmR49AyYJbAs9aj9ATG4yeZ2R7yePNoEOh43ZOKUc+W6jmytZn1KldvUs2mLDOOS/9DzP DTgbs5SMLFY/quRvVtUH8K1aeNtyJEUaGgmz646rVVQ6nQfrat517xMfy1yhAQ== From: "Pankaj Raghav (Samsung)" To: linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org Cc: linux-kernel@vger.kernel.org, david@fromorbit.com, chandan.babu@oracle.com, akpm@linux-foundation.org, mcgrof@kernel.org, ziy@nvidia.com, hare@suse.de, djwong@kernel.org, gost.dev@samsung.com, linux-mm@kvack.org, willy@infradead.org, Pankaj Raghav Subject: [PATCH 02/13] fs: Allow fine-grained control of folio sizes Date: Mon, 26 Feb 2024 10:49:25 +0100 Message-ID: <20240226094936.2677493-3-kernel@pankajraghav.com> In-Reply-To: <20240226094936.2677493-1-kernel@pankajraghav.com> References: <20240226094936.2677493-1-kernel@pankajraghav.com> MIME-Version: 1.0 X-Rspam-User: X-Stat-Signature: xtarpjyqocy8phtcfkbgm3anjt7etras X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: D4A1C1C0005 X-HE-Tag: 1708940993-552269 X-HE-Meta: U2FsdGVkX18FNQLH0dTvHH9DkiZEygs6aUBAiCQxCVdyrzLwzOAspx5AyGDiZvKBRgbSViaRMsJrmI9f+cZvxIibPc3qILK8xMmuE9jtql9w3oI7GOel95gVz6eWF2jzNbwsZSKqzpT0FVpWtz7mO1Cp/ytd/59COAdHZCfkzJ1aSYt4B2vci/6fEd7qkX/wPmLUbOgGEl7aFI4GyQBpptT5JV2WjMirDLsonPPIxwxYS7bPsJuFDTVvq8hY7qJpQQ1nXT1rDHgmyeF8MSA5n56dxfU6i0SU5q6sPLF4JZyaF0LD46FH18FgFGxYlq6y5lCM4xw265w4kDw6WTJ7nK7lBAJvbkV1BJQxXNElxP7HT+6q0/HZOIP347r+3I8eWaXfzSFww7MafLzkH3Kv32+xNQb5Q5gzUrK2H/UMgNIKZIPRJ4N2EUMAYW4egYuW9alVRbfTunVTF5HJ0id9SPBmjyDn+VsDaaXrGEFiL00r2to0WBkEVpdYdNN2pypOGoMi0pM1D8OxLKw3CedGuIXsMia5x+xZBZR6667bXL/kEg6qb5+a5pjj0bb2ZyHzhkqv7/6qwrpKP/JRQ5NHGu51tnJrYBQKaTyHEJKAvFidvBD1B30FskaOixMrIsoWSgV1wduQ9x3L0Kstk5131oM2PTr4nrKjG0194+7jGpJg70qPcYS3Oml1RmeMlrTuUfAgrDTtg+wSBCEzYZIDa6UWrDI6AZ6SWlPoSXoQv8NtjdGnlHmHMkibx2QlNHGr7NQVl4+rDb/glwKfucdhC7wlu6f3p3NynklNht28yBqxJbYbBVrUt8RVA7UVxDAtxRoEXKEJn0ZYWQWKLfCW5Oo1XZxz3sduZF8KIhfNDok/tTNPXt+tcFRc5RmgejI4dn5iifWwjGUrDXQawxNOFqGtq9oowPv5LzSQVA3sU8px41nG4uPn49IfzUn0LL3lS7EpbzyNJl/iVHlqj5P MwfztLhT sdNglmIykafavMgF4QM691FJdj5yY4GYkExRhEMfS3/Gh/LEPU0q2Xhm8CgEQL9Y+3x5XOdlOnOsdrAaWsqUaVVPxCmD5OqVpbiAJIUqmGLU94dVoJZ9a+9K92eVEfIPzuM1BjJ9U/J4dkSx9N3Nlx/Z4RiniP2xaY4CcQihCj/GZt8G2l70/kRDL2FH1b9CwtqnyN8buexHGQQbIgSVbpO7caXF0eIRMcAQNBtnZLgt/AREzT84Hnue7NguppNRRp/j2OwjAsWwRXqvLubwbsE8jAm3SeQVsLGT5XOnfYA1nA0NX+Pzp566vXkv5BxEwq0HDSBWG/mD5c2xUBApLidQrlAFveuL3dVRZix8NoZDxJvVGA/HUGHqnT28VQSxlhBGk6Mr6ESuySn+4Zpg35Pf9LsVjwySuuaMe6lwkAVnGLaxrLv1XkstiLig3gVMVjiCgkMSsubwXVVY= 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: From: "Matthew Wilcox (Oracle)" Some filesystems want to be able to ensure that folios that are added to the page cache are at least a certain size. Add mapping_set_folio_min_order() to allow this level of control. Signed-off-by: Matthew Wilcox (Oracle) Co-developed-by: Pankaj Raghav Signed-off-by: Pankaj Raghav Signed-off-by: Luis Chamberlain --- include/linux/pagemap.h | 100 ++++++++++++++++++++++++++++++++-------- 1 file changed, 80 insertions(+), 20 deletions(-) diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index 2df35e65557d..fc8eb9c94e9c 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h @@ -202,13 +202,18 @@ 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_RELEASE_ALWAYS, /* Call ->release_folio(), even if no private data */ - AS_STABLE_WRITES, /* must wait for writeback before modifying + AS_RELEASE_ALWAYS = 6, /* Call ->release_folio(), even if no private data */ + AS_STABLE_WRITES = 7, /* must wait for writeback before modifying folio contents */ - AS_UNMOVABLE, /* The mapping cannot be moved, ever */ + AS_FOLIO_ORDER_MIN = 8, + AS_FOLIO_ORDER_MAX = 13, /* Bit 8-17 are used for FOLIO_ORDER */ + AS_UNMOVABLE = 18, /* The mapping cannot be moved, ever */ }; +#define AS_FOLIO_ORDER_MIN_MASK 0x00001f00 +#define AS_FOLIO_ORDER_MAX_MASK 0x0003e000 +#define AS_FOLIO_ORDER_MASK (AS_FOLIO_ORDER_MIN_MASK | AS_FOLIO_ORDER_MAX_MASK) + /** * mapping_set_error - record a writeback error in the address_space * @mapping: the mapping in which an error should be set @@ -344,9 +349,47 @@ static inline void mapping_set_gfp_mask(struct address_space *m, gfp_t mask) m->gfp_mask = mask; } +/* + * There are some parts of the kernel which assume that PMD entries + * are exactly HPAGE_PMD_ORDER. Those should be fixed, but until then, + * limit the maximum allocation order to PMD size. I'm not aware of any + * assumptions about maximum order if THP are disabled, but 8 seems like + * a good order (that's 1MB if you're using 4kB pages) + */ +#ifdef CONFIG_TRANSPARENT_HUGEPAGE +#define MAX_PAGECACHE_ORDER HPAGE_PMD_ORDER +#else +#define MAX_PAGECACHE_ORDER 8 +#endif + +/* + * mapping_set_folio_min_order() - Set the minimum folio order + * @mapping: The address_space. + * @min: Minimum folio order (between 0-MAX_PAGECACHE_ORDER inclusive). + * + * The filesystem should call this function in its inode constructor to + * indicate which base size of folio the VFS can use to cache the contents + * of the file. This should only be used if the filesystem needs special + * handling of folio sizes (ie there is something the core cannot know). + * Do not tune it based on, eg, i_size. + * + * Context: This should not be called while the inode is active as it + * is non-atomic. + */ +static inline void mapping_set_folio_min_order(struct address_space *mapping, + unsigned int min) +{ + if (min > MAX_PAGECACHE_ORDER) + min = MAX_PAGECACHE_ORDER; + + mapping->flags = (mapping->flags & ~AS_FOLIO_ORDER_MASK) | + (min << AS_FOLIO_ORDER_MIN) | + (MAX_PAGECACHE_ORDER << AS_FOLIO_ORDER_MAX); +} + /** * mapping_set_large_folios() - Indicate the file supports large folios. - * @mapping: The file. + * @mapping: The address_space. * * The filesystem should call this function in its inode constructor to * indicate that the VFS can use large folios to cache the contents of @@ -357,7 +400,37 @@ static inline void mapping_set_gfp_mask(struct address_space *m, gfp_t mask) */ static inline void mapping_set_large_folios(struct address_space *mapping) { - __set_bit(AS_LARGE_FOLIO_SUPPORT, &mapping->flags); + mapping_set_folio_min_order(mapping, 0); +} + +static inline unsigned int mapping_max_folio_order(struct address_space *mapping) +{ + return (mapping->flags & AS_FOLIO_ORDER_MAX_MASK) >> AS_FOLIO_ORDER_MAX; +} + +static inline unsigned int mapping_min_folio_order(struct address_space *mapping) +{ + return (mapping->flags & AS_FOLIO_ORDER_MIN_MASK) >> AS_FOLIO_ORDER_MIN; +} + +static inline unsigned long mapping_min_folio_nrpages(struct address_space *mapping) +{ + return 1UL << mapping_min_folio_order(mapping); +} + +/** + * mapping_align_start_index() - Align starting index based on the min + * folio order of the page cache. + * @mapping: The address_space. + * + * Ensure the index used is aligned to the minimum folio order when adding + * new folios to the page cache by rounding down to the nearest minimum + * folio number of pages. + */ +static inline pgoff_t mapping_align_start_index(struct address_space *mapping, + pgoff_t index) +{ + return round_down(index, mapping_min_folio_nrpages(mapping)); } /* @@ -367,7 +440,7 @@ static inline void mapping_set_large_folios(struct address_space *mapping) static inline bool mapping_large_folio_support(struct address_space *mapping) { return IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE) && - test_bit(AS_LARGE_FOLIO_SUPPORT, &mapping->flags); + (mapping_max_folio_order(mapping) > 0); } static inline int filemap_nr_thps(struct address_space *mapping) @@ -528,19 +601,6 @@ static inline void *detach_page_private(struct page *page) return folio_detach_private(page_folio(page)); } -/* - * There are some parts of the kernel which assume that PMD entries - * are exactly HPAGE_PMD_ORDER. Those should be fixed, but until then, - * limit the maximum allocation order to PMD size. I'm not aware of any - * assumptions about maximum order if THP are disabled, but 8 seems like - * a good order (that's 1MB if you're using 4kB pages) - */ -#ifdef CONFIG_TRANSPARENT_HUGEPAGE -#define MAX_PAGECACHE_ORDER HPAGE_PMD_ORDER -#else -#define MAX_PAGECACHE_ORDER 8 -#endif - #ifdef CONFIG_NUMA struct folio *filemap_alloc_folio(gfp_t gfp, unsigned int order); #else From patchwork Mon Feb 26 09:49:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Pankaj Raghav (Samsung)" X-Patchwork-Id: 13571761 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 C1809C54E49 for ; Mon, 26 Feb 2024 09:49:59 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4569594001D; Mon, 26 Feb 2024 04:49:59 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 405ED940014; Mon, 26 Feb 2024 04:49:59 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2A7CD94001D; Mon, 26 Feb 2024 04:49:59 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 11995940014 for ; Mon, 26 Feb 2024 04:49:59 -0500 (EST) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id D2443140715 for ; Mon, 26 Feb 2024 09:49:58 +0000 (UTC) X-FDA: 81833483676.10.C116D82 Received: from mout-p-101.mailbox.org (mout-p-101.mailbox.org [80.241.56.151]) by imf21.hostedemail.com (Postfix) with ESMTP id 392641C000C for ; Mon, 26 Feb 2024 09:49:56 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=pankajraghav.com header.s=MBO0001 header.b=bRv8Wx5c; dmarc=none; spf=pass (imf21.hostedemail.com: domain of me@pankajraghav.com designates 80.241.56.151 as permitted sender) smtp.mailfrom=me@pankajraghav.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1708940997; a=rsa-sha256; cv=none; b=3BYN1nQvdnwY0phuamoVwxxAEQVCpXAjCW6q0Z8K2airBfCdMP1gyMyYLgSVwViwOc/Zp4 6Al/h4ukiSe2vIIjOWrSzGqEeZoNG7Uaw13+reOldr0gK9s16LIBp6qP/OQdHi+VkUQTtb 7+B+5+3zqQrGcm2UWe7fqWB2vJZbY0k= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=pankajraghav.com header.s=MBO0001 header.b=bRv8Wx5c; dmarc=none; spf=pass (imf21.hostedemail.com: domain of me@pankajraghav.com designates 80.241.56.151 as permitted sender) smtp.mailfrom=me@pankajraghav.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1708940997; 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:dkim-signature; bh=UE/+ngzUW37ueqbuDmtoyKLgw47SUrAWwA7DBQ7fmXA=; b=YaRUBEv6REhv9BcHQuBe3easafMA/q2Lp1JPw1PFgeLkcCuwfZHvLhEa+A2E3p+dLMh35y BkXQapnsGQ/XF9E3/ZLzT4SjLuZAFHE3RlGmxUlU+8GaiiaJ/0nTZ2dF207GDCLM/t6YGU PvGSlQcdzfZZ1mGsrTOUPvchRE+FGXk= Received: from smtp202.mailbox.org (smtp202.mailbox.org [IPv6:2001:67c:2050:b231:465::202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-101.mailbox.org (Postfix) with ESMTPS id 4Tjwnt1tBzz9sTM; Mon, 26 Feb 2024 10:49:54 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pankajraghav.com; s=MBO0001; t=1708940994; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=UE/+ngzUW37ueqbuDmtoyKLgw47SUrAWwA7DBQ7fmXA=; b=bRv8Wx5cvk1xd9wVeRlOtaJZztEuuuk3hMBOtenVjKOEhVioQUed98THwPiUUu1f9r9DH7 wVd6ZXgT96T6EnmbVf914Uc1jQ24dL54EHczA3owM2IwVEsCOd+na63QUB+HW4d9qUx1k4 bp9FGTWx3r3Ga4N411mN/gefo51B/cN3YxgI8XUjBXEjt1A0bW5GTLmIo6bAvCkwJmSYZr yCwDty8PFIfD+eTzomhQEytKQGuLbLueIt3c2sw5+totLREcGF7IRnsOPc6FjNyCRSOSsq lnNJkHsVkyCXiILF76ixMcjR7kuA4Zp24E1MDjwHFSTRTXs+gDEU8TW1r1YJXQ== From: "Pankaj Raghav (Samsung)" To: linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org Cc: linux-kernel@vger.kernel.org, david@fromorbit.com, chandan.babu@oracle.com, akpm@linux-foundation.org, mcgrof@kernel.org, ziy@nvidia.com, hare@suse.de, djwong@kernel.org, gost.dev@samsung.com, linux-mm@kvack.org, willy@infradead.org, Pankaj Raghav Subject: [PATCH 03/13] filemap: align the index to mapping_min_order in the page cache Date: Mon, 26 Feb 2024 10:49:26 +0100 Message-ID: <20240226094936.2677493-4-kernel@pankajraghav.com> In-Reply-To: <20240226094936.2677493-1-kernel@pankajraghav.com> References: <20240226094936.2677493-1-kernel@pankajraghav.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 392641C000C X-Stat-Signature: ay7mwzhhccd48na75n87z7fq1ceb8hx7 X-HE-Tag: 1708940996-452034 X-HE-Meta: U2FsdGVkX1/D5oEWrgk1tJGlOn/hf6L+K2mtl86a5Lzup6faDvkQ+c6rISqYve9LnNPa7JvEVP7JP42knd3RdPyTW3BuQvubRm8icoHvaNARQbBLReVHPrGXGXznJWBLtXPy/MRhUO1Z8ZfdsrMlvLI3MoC1tSiP3WDpqj5n825PmLZSyCH5FFGFUE3nNwZqt9GBTkLiVSlEPcw2B6lkOYgst4ZLp/nmi/uZ+16y8wiIsUfNx4V0TPpEfB/ZVSh1B/b1hOOSpieJ50TqtLZHtrIab7myYixfMOZIbbRVwtgWWRJCrEWnPo7A3Obo5DhED0EdwIIQKCHq8KEOc7eCumr1G4GUg7e7AQoF34Vp9ytsX6blr++YGhG2K18u2/DloQWP5bQfGxDw9UwYhpwGL5TqJ96SwgONEXhL+hXdLlUyZDwvf04jwtG4fmnwSqzLY3nybOa11NqUXEbahDQ+xVzOJoYZh0epVd1uegW8eiQqA4Zz1hSzKIk2DrzyB/Km9MvwqNSvEXXcd3oiIqJEgpAx6iVcr+n6nn6cUE9GkefjvviPlVdmTHXnTQuiiOL/YkoTBIDkDr6j9YnRHu+V888mlgnIqiagug4biiSpMEgLz2oRUuZwUA09LXLC+ZUujaX9qgL+myDGIKf5GcapUZ6JpmUPOKLU71+e7PPb0Fic2AUMvYdIks91h5Nz4tCoiMb2HS5C+92FzjZ0CMTtKbLTRUgXv5VkLM69vRoeuhZSt2658rQG9tL4oFyE9RPwM/55jzlHKHtw2+1In1qmicbnDPCr3GhbVkAqnzoLeeCkWZk+zGnLBQxtxYskVIQ80+Kt/ZQqhhcqHq/1FHck+XpYZ5V3RnyYFWw1zQqeqxZTLiftlKGeiMqLJNYsFhS/62Y4UcB/6ph2srl8mM22Hw/ht4ibhLNjmYUiGMPVMaPasAeIqKsrrEph3G3crY6pcO3497MYizxmOt4lVnp D4ucP12Y 5+KMVB5LYcZC5dJOF6aQ/rOi0i+54MYGGSf9pdyTOWUVbzVUf+VeF3m4/zoe80v0G1lKWf3eVr5MwWNw4BNrp1zW5V10lqJ9ejSjjo6bSvUAgpL0= 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: From: Luis Chamberlain Supporting mapping_min_order implies that we guarantee each folio in the page cache has at least an order of mapping_min_order. So when adding new folios to the page cache we must ensure the index used is aligned to the mapping_min_order as the page cache requires the index to be aligned to the order of the folio. A higher order folio than min_order by definition is a multiple of the min_order. If an index is aligned to an order higher than a min_order, it will also be aligned to the min order. This effectively introduces no new functional changes when min order is not set other than a few rounding computations that should result in the same value. Signed-off-by: Luis Chamberlain Signed-off-by: Pankaj Raghav --- include/linux/pagemap.h | 8 ++++++++ mm/filemap.c | 22 +++++++++++++--------- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index fc8eb9c94e9c..fe8e1fbb667d 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h @@ -1328,6 +1328,14 @@ struct readahead_control { ._index = i, \ } +#define DEFINE_READAHEAD_ALIGNED(ractl, f, r, m, i) \ + struct readahead_control ractl = { \ + .file = f, \ + .mapping = m, \ + .ra = r, \ + ._index = mapping_align_start_index(m, i), \ + } + #define VM_READAHEAD_PAGES (SZ_128K / PAGE_SIZE) void page_cache_ra_unbounded(struct readahead_control *, diff --git a/mm/filemap.c b/mm/filemap.c index 2b00442b9d19..bdf4f65f597c 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -2478,11 +2478,11 @@ static int filemap_get_pages(struct kiocb *iocb, size_t count, struct file *filp = iocb->ki_filp; struct address_space *mapping = filp->f_mapping; struct file_ra_state *ra = &filp->f_ra; - pgoff_t index = iocb->ki_pos >> PAGE_SHIFT; - pgoff_t last_index; + pgoff_t index, last_index; struct folio *folio; int err = 0; + index = mapping_align_start_index(mapping, iocb->ki_pos >> PAGE_SHIFT); /* "last_index" is the index of the page beyond the end of the read */ last_index = DIV_ROUND_UP(iocb->ki_pos + count, PAGE_SIZE); retry: @@ -2500,8 +2500,7 @@ static int filemap_get_pages(struct kiocb *iocb, size_t count, if (!folio_batch_count(fbatch)) { if (iocb->ki_flags & (IOCB_NOWAIT | IOCB_WAITQ)) return -EAGAIN; - err = filemap_create_folio(filp, mapping, - iocb->ki_pos >> PAGE_SHIFT, fbatch); + err = filemap_create_folio(filp, mapping, index, fbatch); if (err == AOP_TRUNCATED_PAGE) goto retry; return err; @@ -3093,7 +3092,7 @@ static struct file *do_sync_mmap_readahead(struct vm_fault *vmf) struct file *file = vmf->vma->vm_file; struct file_ra_state *ra = &file->f_ra; struct address_space *mapping = file->f_mapping; - DEFINE_READAHEAD(ractl, file, ra, mapping, vmf->pgoff); + DEFINE_READAHEAD_ALIGNED(ractl, file, ra, mapping, vmf->pgoff); struct file *fpin = NULL; unsigned long vm_flags = vmf->vma->vm_flags; unsigned int mmap_miss; @@ -3147,7 +3146,7 @@ static struct file *do_sync_mmap_readahead(struct vm_fault *vmf) ra->start = max_t(long, 0, vmf->pgoff - ra->ra_pages / 2); ra->size = ra->ra_pages; ra->async_size = ra->ra_pages / 4; - ractl._index = ra->start; + ractl._index = mapping_align_start_index(mapping, ra->start); page_cache_ra_order(&ractl, ra, 0); return fpin; } @@ -3162,7 +3161,7 @@ static struct file *do_async_mmap_readahead(struct vm_fault *vmf, { struct file *file = vmf->vma->vm_file; struct file_ra_state *ra = &file->f_ra; - DEFINE_READAHEAD(ractl, file, ra, file->f_mapping, vmf->pgoff); + DEFINE_READAHEAD_ALIGNED(ractl, file, ra, file->f_mapping, vmf->pgoff); struct file *fpin = NULL; unsigned int mmap_miss; @@ -3211,11 +3210,12 @@ vm_fault_t filemap_fault(struct vm_fault *vmf) struct file *fpin = NULL; struct address_space *mapping = file->f_mapping; struct inode *inode = mapping->host; - pgoff_t max_idx, index = vmf->pgoff; + pgoff_t max_idx, index; struct folio *folio; vm_fault_t ret = 0; bool mapping_locked = false; + index = mapping_align_start_index(mapping, vmf->pgoff); max_idx = DIV_ROUND_UP(i_size_read(inode), PAGE_SIZE); if (unlikely(index >= max_idx)) return VM_FAULT_SIGBUS; @@ -3321,7 +3321,10 @@ vm_fault_t filemap_fault(struct vm_fault *vmf) return VM_FAULT_SIGBUS; } - vmf->page = folio_file_page(folio, index); + VM_BUG_ON_FOLIO(folio_order(folio) < mapping_min_folio_order(mapping), + folio); + + vmf->page = folio_file_page(folio, vmf->pgoff); return ret | VM_FAULT_LOCKED; page_not_uptodate: @@ -3657,6 +3660,7 @@ static struct folio *do_read_cache_folio(struct address_space *mapping, struct folio *folio; int err; + index = mapping_align_start_index(mapping, index); if (!filler) filler = mapping->a_ops->read_folio; repeat: From patchwork Mon Feb 26 09:49:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Pankaj Raghav (Samsung)" X-Patchwork-Id: 13571762 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 1865CC54E49 for ; Mon, 26 Feb 2024 09:50:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 93A0094001E; Mon, 26 Feb 2024 04:50:03 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 899EC940014; Mon, 26 Feb 2024 04:50:03 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 73B3494001E; Mon, 26 Feb 2024 04:50:03 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 61172940014 for ; Mon, 26 Feb 2024 04:50:03 -0500 (EST) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 03374C07D8 for ; Mon, 26 Feb 2024 09:50:02 +0000 (UTC) X-FDA: 81833483886.16.8F399AC Received: from mout-p-101.mailbox.org (mout-p-101.mailbox.org [80.241.56.151]) by imf30.hostedemail.com (Postfix) with ESMTP id 65F4080010 for ; Mon, 26 Feb 2024 09:50:01 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=pankajraghav.com header.s=MBO0001 header.b="k+/Se9RL"; spf=pass (imf30.hostedemail.com: domain of me@pankajraghav.com designates 80.241.56.151 as permitted sender) smtp.mailfrom=me@pankajraghav.com; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1708941001; a=rsa-sha256; cv=none; b=ub4TG9ykdwA3bWygRwdqf/JbVeEO3rFak70pkZX3RCPQ7WBAPNWFO2DoCGBccyPfBLoaM+ oYKvMxUBUy3SPq1pqiE2OPXx2jTrvSoF0yhZ4hjHY5Yw91AxJmwiRqrBG7Zk4ia/hK83K6 hqhvbbOz2gkeiWNLkVFCxBrNZNrnh38= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=pankajraghav.com header.s=MBO0001 header.b="k+/Se9RL"; spf=pass (imf30.hostedemail.com: domain of me@pankajraghav.com designates 80.241.56.151 as permitted sender) smtp.mailfrom=me@pankajraghav.com; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1708941001; 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:dkim-signature; bh=dxmi9nVYwim1cNNfe2Xlh2MStfm/gxTJRd9QPZsgFwc=; b=3Dhz67jsh/UV+xE0OxhoKXO/A9HhXHgmIMSjursCFhveMoXT5j37nouAacTxMdLaU8LOU4 /N32WHduFdTs/uE1uVcQJfkgMZcfktFac2r6ohEV+2MavP0hHUbDIZdHfi4c2U15JRE6RM qAIVtJlT5WD4b6Uvwls88uhZQ0vZ8xw= Received: from smtp2.mailbox.org (smtp2.mailbox.org [IPv6:2001:67c:2050:b231:465::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-101.mailbox.org (Postfix) with ESMTPS id 4Tjwny230Zz9sd7; Mon, 26 Feb 2024 10:49:58 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pankajraghav.com; s=MBO0001; t=1708940998; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=dxmi9nVYwim1cNNfe2Xlh2MStfm/gxTJRd9QPZsgFwc=; b=k+/Se9RLgvLTB8sb1uVay3Y3/zq/KKPrHWmX8ufvZwefrZwIlUZfRJ0xhs2kSLt6KkAjZ0 9MhFKa3OZzoGhJhjkXWfmOyOmF6woVxT8c4RkkyYzVoI+NsAWx9L+rFJyTV/+HVlrL7F7J Syh0kvGX8dYH758lZpESl95+fW81cGnQCMLeqVuZ5ygto6rxyq+UTXhfeGE8R8KTkQyjIg mJAkC9sTnrgntU6ZIPmJk5y6f+LDnq6nvSS1raDz9Jbn5PyL/vN7dzypafSByUv5sFm/tl 4mvQEppUs15HBHAzDg/EKxrm8u1fJ2KPfgzmxH28w64LHM1jHLhVdQWK6O39yg== From: "Pankaj Raghav (Samsung)" To: linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org Cc: linux-kernel@vger.kernel.org, david@fromorbit.com, chandan.babu@oracle.com, akpm@linux-foundation.org, mcgrof@kernel.org, ziy@nvidia.com, hare@suse.de, djwong@kernel.org, gost.dev@samsung.com, linux-mm@kvack.org, willy@infradead.org, Pankaj Raghav Subject: [PATCH 04/13] filemap: use mapping_min_order while allocating folios Date: Mon, 26 Feb 2024 10:49:27 +0100 Message-ID: <20240226094936.2677493-5-kernel@pankajraghav.com> In-Reply-To: <20240226094936.2677493-1-kernel@pankajraghav.com> References: <20240226094936.2677493-1-kernel@pankajraghav.com> MIME-Version: 1.0 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 65F4080010 X-Stat-Signature: jpzkiuz7g3p64aohirmotgawtr4adb3h X-Rspam-User: X-HE-Tag: 1708941001-711518 X-HE-Meta: U2FsdGVkX18L1B5FQ1dPThC6V3y4rejuUInPRsjl6JDzf0skw99IW5y5XT50wRqlnLXV1LLcpRVBScF1i03YZHr7fl8X/LpyH2f24lbTSTXYf2I6r7EkphK8t9MUO4mnf7MSORSM0d8SPR3pR2Xmb50R3mC2zmthEDCL6olcn2WcdREDzOMS1/aXtyJqTH+WnRUQotNMD/cmMLS3CFD1lADN7hhXlExzGn/DaNrTzAcA4SJWm0ggc5VXstJX//I2O436sEdG9x2G+/ul8F1ArtQ0wB31SYBF24gFx4qwKWo1xmXoBtAl3Pmuwz3lOuR+muL6kDQuizGGh0+lCuxc5qWMUydviT4aagg00VzBtf2hWTka+nKeWqZJ/hr2+5DGOPkIAPufW3hyV+K4PuOrkvwmOWcjlNyXbczBOYD85AqUkqCpwM9DjCKXOmTE+zyaisMwaV2m+R/1eYc+9IBEd0Yc9Gkk4bxaeUBJ+q7iJPf0xNX+FBVg4B7Mgh9oPbL959O+kRKndEb0U1xMmILFI1mH0SbUlmxc0RUIvGBOXOPXhv9XHZT6a+DXcRVqyy/QCW2q9tpoRATX3bz0AMYiDfWewJuFOMLryCZgJ4iXv81+0S0llkqmbOSRIieIxOMI1dtO2el74MyzrwLzL2Aundizd5cAUccOMYzeuebUTWLjYlccBd1+d1vxP5GbWKfHamStpsd2jMDJ6OPdQPxjSgmsgKVN5hyc+n2VKCLvhAw5JXy/nSy5kJVUGRRc+DDropka+fP5rUeRJrzLymr6MpwHXzhr2SXrQsDBupYvwtPRm9TupzK5f2v4WgQOG7lk0sBa4mXLEFqWAz0EnibiXoKIOTju9g6Sc+pPDk/74ulfKzIgX3JOZj9cyx0joGVrpdk9CYDFESl1MCM5INnIUvRnUcNNYlA8KTsaBoyODCL3JyBUf+5TrEK8rJd1eAwmUoxZTOXkTJ0xKJ7/N+/ t6mL+EZE vlq/XzuKpUONZ5ViQ2yNKNG4O8YS0EcL0qIeGdMDZmcvK7npDOQGZwhTKTmEABeZU5zy0HkbBiAnZrPwx0kfo2a1vpPTb+jZa8nLd1PPokrTRDC4= 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: From: Pankaj Raghav filemap_create_folio() and do_read_cache_folio() were always allocating folio of order 0. __filemap_get_folio was trying to allocate higher order folios when fgp_flags had higher order hint set but it will default to order 0 folio if higher order memory allocation fails. As we bring the notion of mapping_min_order, make sure these functions allocate at least folio of mapping_min_order as we need to guarantee it in the page cache. Add some additional VM_BUG_ON() in page_cache_delete[batch] and __filemap_add_folio to catch errors where we delete or add folios that has order less than min_order. Signed-off-by: Pankaj Raghav Signed-off-by: Luis Chamberlain Reviewed-by: Hannes Reinecke Acked-by: Darrick J. Wong --- mm/filemap.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/mm/filemap.c b/mm/filemap.c index bdf4f65f597c..4b144479c4cb 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -135,6 +135,8 @@ static void page_cache_delete(struct address_space *mapping, xas_set_order(&xas, folio->index, folio_order(folio)); nr = folio_nr_pages(folio); + VM_BUG_ON_FOLIO(folio_order(folio) < mapping_min_folio_order(mapping), + folio); VM_BUG_ON_FOLIO(!folio_test_locked(folio), folio); xas_store(&xas, shadow); @@ -305,6 +307,8 @@ static void page_cache_delete_batch(struct address_space *mapping, WARN_ON_ONCE(!folio_test_locked(folio)); + VM_BUG_ON_FOLIO(folio_order(folio) < mapping_min_folio_order(mapping), + folio); folio->mapping = NULL; /* Leave folio->index set: truncation lookup relies on it */ @@ -896,6 +900,8 @@ noinline int __filemap_add_folio(struct address_space *mapping, } } + VM_BUG_ON_FOLIO(folio_order(folio) < mapping_min_folio_order(mapping), + folio); xas_store(&xas, folio); if (xas_error(&xas)) goto unlock; @@ -1847,6 +1853,9 @@ struct folio *__filemap_get_folio(struct address_space *mapping, pgoff_t index, fgf_t fgp_flags, gfp_t gfp) { struct folio *folio; + unsigned int min_order = mapping_min_folio_order(mapping); + + index = mapping_align_start_index(mapping, index); repeat: folio = filemap_get_entry(mapping, index); @@ -1886,7 +1895,7 @@ struct folio *__filemap_get_folio(struct address_space *mapping, pgoff_t index, folio_wait_stable(folio); no_page: if (!folio && (fgp_flags & FGP_CREAT)) { - unsigned order = FGF_GET_ORDER(fgp_flags); + unsigned int order = max(min_order, FGF_GET_ORDER(fgp_flags)); int err; if ((fgp_flags & FGP_WRITE) && mapping_can_writeback(mapping)) @@ -1912,8 +1921,13 @@ struct folio *__filemap_get_folio(struct address_space *mapping, pgoff_t index, gfp_t alloc_gfp = gfp; err = -ENOMEM; + if (order < min_order) + order = min_order; if (order > 0) alloc_gfp |= __GFP_NORETRY | __GFP_NOWARN; + + VM_BUG_ON(index & ((1UL << order) - 1)); + folio = filemap_alloc_folio(alloc_gfp, order); if (!folio) continue; @@ -1927,7 +1941,7 @@ struct folio *__filemap_get_folio(struct address_space *mapping, pgoff_t index, break; folio_put(folio); folio = NULL; - } while (order-- > 0); + } while (order-- > min_order); if (err == -EEXIST) goto repeat; @@ -2422,7 +2436,8 @@ static int filemap_create_folio(struct file *file, struct folio *folio; int error; - folio = filemap_alloc_folio(mapping_gfp_mask(mapping), 0); + folio = filemap_alloc_folio(mapping_gfp_mask(mapping), + mapping_min_folio_order(mapping)); if (!folio) return -ENOMEM; @@ -3666,7 +3681,8 @@ static struct folio *do_read_cache_folio(struct address_space *mapping, repeat: folio = filemap_get_folio(mapping, index); if (IS_ERR(folio)) { - folio = filemap_alloc_folio(gfp, 0); + folio = filemap_alloc_folio(gfp, + mapping_min_folio_order(mapping)); if (!folio) return ERR_PTR(-ENOMEM); err = filemap_add_folio(mapping, folio, index, gfp); From patchwork Mon Feb 26 09:49:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Pankaj Raghav (Samsung)" X-Patchwork-Id: 13571763 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 09F96C48BF6 for ; Mon, 26 Feb 2024 09:50:08 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8EBB994001F; Mon, 26 Feb 2024 04:50:07 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 89A8D940014; Mon, 26 Feb 2024 04:50:07 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7147994001F; Mon, 26 Feb 2024 04:50:07 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 5E5BA940014 for ; Mon, 26 Feb 2024 04:50:07 -0500 (EST) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 37DB880788 for ; Mon, 26 Feb 2024 09:50:07 +0000 (UTC) X-FDA: 81833484054.15.FB5A56E Received: from mout-p-101.mailbox.org (mout-p-101.mailbox.org [80.241.56.151]) by imf04.hostedemail.com (Postfix) with ESMTP id 85A604000E for ; Mon, 26 Feb 2024 09:50:05 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=pankajraghav.com header.s=MBO0001 header.b=UvS4naGN; dmarc=none; spf=pass (imf04.hostedemail.com: domain of me@pankajraghav.com designates 80.241.56.151 as permitted sender) smtp.mailfrom=me@pankajraghav.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1708941005; 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:dkim-signature; bh=1njdQFWaR2BtfAMszTyy2iO3Y5kDTGCSewwBty7+2Kw=; b=RNYQ9V4de6uHzHO6yGSrl5waC0YxsDD/fIDx5kyfxTWrYgTRAXM83p6Dap9KUvSqr0sodb UYAgYIGWptqG6zWSnmPqarT7OUtv8BPQbuvhMGxznVvkUFNKaOt2INg7loNOCXXPy9o5ov iwLubk49olxmzLZ5qY7ZoPUmb5Mbrns= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=pankajraghav.com header.s=MBO0001 header.b=UvS4naGN; dmarc=none; spf=pass (imf04.hostedemail.com: domain of me@pankajraghav.com designates 80.241.56.151 as permitted sender) smtp.mailfrom=me@pankajraghav.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1708941005; a=rsa-sha256; cv=none; b=OnEHCY/OOdp+VVe+c6w+zh6IBPeb9CY/dYyh5/6hJhvWDS+As1+ZpVIOCjLN3urKLdrGWZ ywmW7DTwrBadhxltku5pZw+8l9Ivv6l49FgstqfyBjFIB12Im+74nQ1gwATADPem7lS35T TfGFAvci5DrW7MDcImvOM19eo1PdYq8= Received: from smtp2.mailbox.org (smtp2.mailbox.org [IPv6:2001:67c:2050:b231:465::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-101.mailbox.org (Postfix) with ESMTPS id 4Tjwp22M3Bz9sTN; Mon, 26 Feb 2024 10:50:02 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pankajraghav.com; s=MBO0001; t=1708941002; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1njdQFWaR2BtfAMszTyy2iO3Y5kDTGCSewwBty7+2Kw=; b=UvS4naGN4B56NJsI1HXSdud2G5jomcFJ6pR8o51SW+VBhDFliKwBLh4YZFda4FACselOUk sr4+d8VOS/b+sN0XHZQ6vaUSG3xl6nmuAanTZxrifjgawftiv6ksfHNzhwGDNJf6w42bDq lmZGaWCeBHrP8LsXhFaYvtWRjZpr6UlNDGjI7mlb47aYk7yS02GDIhAfcwoWIGEpMwbP2y TD3mOqA99RywbbiYZMURMmzzCB8mckCp+XBDQmQZmvggaMnvwZEK0aKR1RuwYYdM4qnyBj WJ8s1ztuAJLE9Fm/QlnPXMTzGrmXUvfuxF5DfPZIOnX717VcvRq0XaL7/vXmgA== From: "Pankaj Raghav (Samsung)" To: linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org Cc: linux-kernel@vger.kernel.org, david@fromorbit.com, chandan.babu@oracle.com, akpm@linux-foundation.org, mcgrof@kernel.org, ziy@nvidia.com, hare@suse.de, djwong@kernel.org, gost.dev@samsung.com, linux-mm@kvack.org, willy@infradead.org, Pankaj Raghav Subject: [PATCH 05/13] readahead: set file_ra_state->ra_pages to be at least mapping_min_order Date: Mon, 26 Feb 2024 10:49:28 +0100 Message-ID: <20240226094936.2677493-6-kernel@pankajraghav.com> In-Reply-To: <20240226094936.2677493-1-kernel@pankajraghav.com> References: <20240226094936.2677493-1-kernel@pankajraghav.com> MIME-Version: 1.0 X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 85A604000E X-Stat-Signature: gedjzd5re9gsdm4zef57n465j9gdd9uq X-Rspam-User: X-HE-Tag: 1708941005-672346 X-HE-Meta: U2FsdGVkX18ZCBXIn9+y4l4FYxgkHgVLhJyk1Jh5jf99XmBoQSLKAo96kyBjDa2USQiyGdQLyvubMMLlQQD01YAbxL6OwZjLKPPOHarAtNj93V+oLzrvOhDZozWHyTFf0569Sezjrh4ev+PPjZxEVWv7s+3k6bQxHYymshKtAuM1m0dWBq9SFT8n9zzlbJC2XNX6KpUbCLUdJmpNHX9ZbfP+jDfYmvVTyJnjXb1fVAawSzrgpcCQTmuBB7VR9eqi7ji2sfzgUJycHSQAQIuao+QDzoD4KZmL0/fuXErKXCNrSBoSaHHWrBFbdYejc7RVENUms1LHpsnjn54THdFKGvdtEMJCDBH7WvOUkw7+LbUICFbDUlT+z7xy3UXnkqXpNZre82bpYwxhnHzdaAyhlxnnTgfhzMgRJZROATON+P1F2BTOmTA7M9pu2AJTVdScXYBHVgpgx19th7gxuBLv8UxBliiI2FybKeZmgezTzRFHO8b/SrxXy0MdPPsqYeNPjHEXxiWSyrweNmOsf011kfkBV0hFbc8VDJx7p29Es21DijN9vX2ZZ8dCupvVZFxaxkdE6euFpo2YQdG2ZXbyBWhaflu+M+WEt1gmMswuZu7LOjL/Qr66CVOXDMLWY66QR1M1Tynr1qZUgRuzRWbXQGcI6qzv1sRoZxplrYFVUHXfwcpBTKSoX0teDVJZKIEdX1QKhXym3Q16lD/7PBEppWeosTIWFVhUvFJo/dnm8P9arL0W3dLSiDy+6S1nMzzKd47hp6olaL5PMf7VOkSAgkpNFQbHwlLcO+kthq0OD6t4V+JG/YDthckDDESc/ChvOmCuBCQ0bHPtv1FGZkSQun1HhUjc98T7MP+8Eaq8vumy+jy7QE+NZhNsqqm3an/wbnHJMVia51bmsYuwGdI5CIauN2Xjz0OsyZW14nx0BVqrGg2Q74/I3OPrm9XCf8KfGVVt9jyuSnwq/kmcEgp SytBW2EF lQBGU8MCJMHHALV072YGj6pm/mrpFxj9mU8JjHphWLIr+5tBSmReWe3t/piRungOA90laSxgqqVOLU4A+5KvjV+CObTB1Ujm1A8szI8rBF1Vxq2cMIv4gJAK6ZNjCDugU+HN5sYx0f7+JcBeABdoleixI/+Wsvz+bFXepwa38blZi9KOtJb9ZKlQ/v5XmnReyeisLVtQMEWy9ZJxztuL+tRl1Csfb1xFCtBAhZ19j1LkwdbpEKsDuo7ldQS7s8G+Vc6ZNOvppTSXWQ1tHRo9/Ut4agAoktkf2b0JswbUzMkZSrzhkIshIBWSp5gUInfLAkIeFtDFXZmr6nkxcw/+x/fwC6q8SQeEMdMZwokaWA7SOYHpkddPTDoNMVAs2fiarAchfs4lgnvdtjPpDkL4xWps1/cZppAHLBdn17aclcbkgel3nxKE4eURQog== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000006, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: From: Luis Chamberlain Set the file_ra_state->ra_pages in file_ra_state_init() to be at least mapping_min_order of pages if the bdi->ra_pages is less than that. Signed-off-by: Luis Chamberlain Signed-off-by: Pankaj Raghav --- mm/readahead.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mm/readahead.c b/mm/readahead.c index 369c70e2be42..8a610b78d94b 100644 --- a/mm/readahead.c +++ b/mm/readahead.c @@ -138,7 +138,11 @@ void file_ra_state_init(struct file_ra_state *ra, struct address_space *mapping) { + unsigned int min_nrpages = mapping_min_folio_nrpages(mapping); + ra->ra_pages = inode_to_bdi(mapping->host)->ra_pages; + if (ra->ra_pages < min_nrpages) + ra->ra_pages = min_nrpages; ra->prev_pos = -1; } EXPORT_SYMBOL_GPL(file_ra_state_init); From patchwork Mon Feb 26 09:49:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Pankaj Raghav (Samsung)" X-Patchwork-Id: 13571764 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 20D2EC48BF6 for ; Mon, 26 Feb 2024 09:50:13 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A23FC940020; Mon, 26 Feb 2024 04:50:12 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 98373940014; Mon, 26 Feb 2024 04:50:12 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 82523940020; Mon, 26 Feb 2024 04:50:12 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 6F3CC940014 for ; Mon, 26 Feb 2024 04:50:12 -0500 (EST) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 502CFA074F for ; Mon, 26 Feb 2024 09:50:12 +0000 (UTC) X-FDA: 81833484264.11.9FA2745 Received: from mout-p-102.mailbox.org (mout-p-102.mailbox.org [80.241.56.152]) by imf25.hostedemail.com (Postfix) with ESMTP id A98A0A0002 for ; Mon, 26 Feb 2024 09:50:10 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=pankajraghav.com header.s=MBO0001 header.b="LK4xL/zq"; dmarc=none; spf=pass (imf25.hostedemail.com: domain of me@pankajraghav.com designates 80.241.56.152 as permitted sender) smtp.mailfrom=me@pankajraghav.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1708941011; a=rsa-sha256; cv=none; b=rVQgLTDwLBYapyhZnfSnUv8B8TFsb6MQdk2+7MZyWEXX12EE1MWSekd7/o8LNLNmXjb19T iCFLO0/gwAhnTIiXTRZO+IghiOHUBfpQl4/+3XKh2M+2x1cIlfaP6qY1J7IFs/HKYlcRGf rFQIUMP5rzokVI9UhTcibiIZg7yJ2ic= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=pankajraghav.com header.s=MBO0001 header.b="LK4xL/zq"; dmarc=none; spf=pass (imf25.hostedemail.com: domain of me@pankajraghav.com designates 80.241.56.152 as permitted sender) smtp.mailfrom=me@pankajraghav.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1708941011; 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:dkim-signature; bh=/iWtDtcsIIVhWdsgAPg59nbWoOxmbwnUSiPp0I9sy7c=; b=ACzmBcAijC7SHagHG2hpuZOFUxo4ItlRZ/FiNL3nLbo6ABYN+FLhz56YWECD9gDE6Zf6cb gF22CF40kBDcaapSfpIC8OXzMGXKDP7OMhgob6hrY7jHqo2aN3f497YFI9N907lN14gjTX L09lUw1fRf3yowpHFjskArThxJyTWA0= Received: from smtp2.mailbox.org (smtp2.mailbox.org [IPv6:2001:67c:2050:b231:465::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-102.mailbox.org (Postfix) with ESMTPS id 4Tjwp748Vjz9sp7; Mon, 26 Feb 2024 10:50:07 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pankajraghav.com; s=MBO0001; t=1708941007; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/iWtDtcsIIVhWdsgAPg59nbWoOxmbwnUSiPp0I9sy7c=; b=LK4xL/zqaOcK2C5cLdqWnyrsWrnOSrjd9JTjUKcDU36GVSLc7/PAhmIrSGgJHHPVt8jyaA CgAzmkvPxMIBSBLcmcHaWd47UtkpWFQwiVv9/6AbPdnMxLve7raB9+Dk0fDTKnmm9LKncR ofaxnSbT+9OLB0DXuaRe+tj1SBO/0HueXcK5qRpFENHtJ8B/WVgvHro2xe4XGQ1OM6o+cT 9QBmPtxoMmp7aubJY+9oya4KZl1IXYuPch7eyw8l+I6AeRy0I0d//IH87DD6EgY948jKob VEkkuCR9FEEG3hCVfOsWiirFMc8BLEn1q7pwYRWY0o9sYRQnlRp1e5YWUsfuDg== From: "Pankaj Raghav (Samsung)" To: linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org Cc: linux-kernel@vger.kernel.org, david@fromorbit.com, chandan.babu@oracle.com, akpm@linux-foundation.org, mcgrof@kernel.org, ziy@nvidia.com, hare@suse.de, djwong@kernel.org, gost.dev@samsung.com, linux-mm@kvack.org, willy@infradead.org, Pankaj Raghav Subject: [PATCH 06/13] readahead: align index to mapping_min_order in ondemand_ra and force_ra Date: Mon, 26 Feb 2024 10:49:29 +0100 Message-ID: <20240226094936.2677493-7-kernel@pankajraghav.com> In-Reply-To: <20240226094936.2677493-1-kernel@pankajraghav.com> References: <20240226094936.2677493-1-kernel@pankajraghav.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: A98A0A0002 X-Stat-Signature: us4daa3cy3wnh6k6bn5xzy74x3xcmsqx X-HE-Tag: 1708941010-614464 X-HE-Meta: U2FsdGVkX1+E3Bs1tZfxlNhsGPGYrKn13TSticYgkTihwkkfspju90+DpATdDopo7RFu8NTb5KWRHvAgT+PgpQ1vZDSf9no7m1+K0uTF/YmAqez1Pqp+a9R9GKqWHdklGwakBSDFweQlxr9Mqbtt8/4VOppAzAmbrW2zBDN3sgiVoNQAeyV9rI/DK2m0nJbZfjb5DmGItdVB3XS3w8vVSpYxPiM3YmC2I09IIL049Wpq9sSbHRPiTG8p5OWmYl4z1DrGBpDyF8mUOrJGeIon9Fqk52SS7u8sthIfDhPUhuZo+n6ywH9REgGEIg6KUKc+2xaoYLzqkG/47UJRbWWB99HVK7mi0Vcbs/3vFf/7VwnDihnT5XflhFFupH+3lgUCUmkQIS6MI+euIQP5RIeKahk3U6Ec0F3UdBzLwIItD4P/4j/X3j17Sgo9IHu5AqrQ+deyt68kDU74lmjMO5BKkS9hA4P14i3zg7cb2+OBKKmpnrG9cJsLnSDnp1rtCcq+OSvQJyVd9Gfuq1ruQmnOlMOPHH6+Dznf/uNnkEh6kdutfx5e9mJZw4hO2YEKnN6YqpdWOWVvDOw3fQqqixCygwI9SldKJNB87KISt5MOx0wuxBaGEBZC08v5D+vvTtV4g4ixk+ezRFRFTH66kNAZe9demEe+betam7ZS+1y8JWVvvmufn7Rv5ZFaCPsYKsjE3cacUh/VfW+Ug0RcT2V90Q/BFdXfQpO7+5aK75oMl/l3hhu/MUrFfQwhCqWwdE46rlM3CAVMIp9N1iAG3xsgcVASwvtEISUvb1SNJgqrmdSu6CtN+sMEGYVCozSOitkgDUvKOi3P9a8NbIDCPfv/M+ECrIqonqVwkunFStSxaj683aTl0ldI9CjEMfEODKlG5w8BzQAiX4C/xxBp/aC7lGHLFCVOn+y/zla9EF8C6RPQji+ZW7hJjs4ouKQCgCBwUeYTj8LRagGXBzDZQws 1ADR1mol sJSyMui3t6SzE/1buWQw2YKHMTeEncNp7+JdKMLdtxheNrUOz5nFupgPX3jk7F9efQvX4yFl/t5KVIaeVJKZn++XRHkssPNnVfrTe+NLgzZZ9gDc= 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: From: Luis Chamberlain Align the ra->start and ra->size to mapping_min_order in ondemand_readahead(), and align the index to mapping_min_order in force_page_cache_ra(). This will ensure that the folios allocated for readahead that are added to the page cache are aligned to mapping_min_order. Signed-off-by: Luis Chamberlain Signed-off-by: Pankaj Raghav --- mm/readahead.c | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/mm/readahead.c b/mm/readahead.c index 8a610b78d94b..325a25e4ee3a 100644 --- a/mm/readahead.c +++ b/mm/readahead.c @@ -313,7 +313,9 @@ void force_page_cache_ra(struct readahead_control *ractl, struct address_space *mapping = ractl->mapping; struct file_ra_state *ra = ractl->ra; struct backing_dev_info *bdi = inode_to_bdi(mapping->host); - unsigned long max_pages, index; + unsigned long max_pages; + pgoff_t index, new_index; + unsigned long min_nrpages = mapping_min_folio_nrpages(mapping); if (unlikely(!mapping->a_ops->read_folio && !mapping->a_ops->readahead)) return; @@ -323,7 +325,14 @@ void force_page_cache_ra(struct readahead_control *ractl, * be up to the optimal hardware IO size */ index = readahead_index(ractl); + new_index = mapping_align_start_index(mapping, index); + if (new_index != index) { + nr_to_read += index - new_index; + index = new_index; + } + max_pages = max_t(unsigned long, bdi->io_pages, ra->ra_pages); + max_pages = max_t(unsigned long, max_pages, min_nrpages); nr_to_read = min_t(unsigned long, nr_to_read, max_pages); while (nr_to_read) { unsigned long this_chunk = (2 * 1024 * 1024) / PAGE_SIZE; @@ -331,6 +340,7 @@ void force_page_cache_ra(struct readahead_control *ractl, if (this_chunk > nr_to_read) this_chunk = nr_to_read; ractl->_index = index; + VM_BUG_ON(!IS_ALIGNED(index, min_nrpages)); do_page_cache_ra(ractl, this_chunk, 0); index += this_chunk; @@ -557,8 +567,11 @@ static void ondemand_readahead(struct readahead_control *ractl, unsigned long add_pages; pgoff_t index = readahead_index(ractl); pgoff_t expected, prev_index; - unsigned int order = folio ? folio_order(folio) : 0; + unsigned int min_order = mapping_min_folio_order(ractl->mapping); + unsigned int min_nrpages = mapping_min_folio_nrpages(ractl->mapping); + unsigned int order = folio ? folio_order(folio) : min_order; + VM_BUG_ON(!IS_ALIGNED(index, min_nrpages)); /* * If the request exceeds the readahead window, allow the read to * be up to the optimal hardware IO size @@ -580,7 +593,7 @@ static void ondemand_readahead(struct readahead_control *ractl, 1UL << order); if (index == expected || index == (ra->start + ra->size)) { ra->start += ra->size; - ra->size = get_next_ra_size(ra, max_pages); + ra->size = max(get_next_ra_size(ra, max_pages), min_nrpages); ra->async_size = ra->size; goto readit; } @@ -605,7 +618,7 @@ static void ondemand_readahead(struct readahead_control *ractl, ra->start = start; ra->size = start - index; /* old async_size */ ra->size += req_size; - ra->size = get_next_ra_size(ra, max_pages); + ra->size = max(get_next_ra_size(ra, max_pages), min_nrpages); ra->async_size = ra->size; goto readit; } @@ -642,7 +655,7 @@ static void ondemand_readahead(struct readahead_control *ractl, initial_readahead: ra->start = index; - ra->size = get_init_ra_size(req_size, max_pages); + ra->size = max(min_nrpages, get_init_ra_size(req_size, max_pages)); ra->async_size = ra->size > req_size ? ra->size - req_size : ra->size; readit: @@ -653,7 +666,7 @@ static void ondemand_readahead(struct readahead_control *ractl, * Take care of maximum IO pages as above. */ if (index == ra->start && ra->size == ra->async_size) { - add_pages = get_next_ra_size(ra, max_pages); + add_pages = max(get_next_ra_size(ra, max_pages), min_nrpages); if (ra->size + add_pages <= max_pages) { ra->async_size = add_pages; ra->size += add_pages; @@ -663,7 +676,7 @@ static void ondemand_readahead(struct readahead_control *ractl, } } - ractl->_index = ra->start; + ractl->_index = mapping_align_start_index(ractl->mapping, ra->start); page_cache_ra_order(ractl, ra, order); } From patchwork Mon Feb 26 09:49:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Pankaj Raghav (Samsung)" X-Patchwork-Id: 13571765 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 0A88DC48BF6 for ; Mon, 26 Feb 2024 09:50:18 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 911B2940021; Mon, 26 Feb 2024 04:50:17 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 8C0FE940014; Mon, 26 Feb 2024 04:50:17 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7891B940021; Mon, 26 Feb 2024 04:50:17 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 68867940014 for ; Mon, 26 Feb 2024 04:50:17 -0500 (EST) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 4AB6D1C0868 for ; Mon, 26 Feb 2024 09:50:17 +0000 (UTC) X-FDA: 81833484474.13.9A90072 Received: from mout-p-202.mailbox.org (mout-p-202.mailbox.org [80.241.56.172]) by imf13.hostedemail.com (Postfix) with ESMTP id C334620013 for ; Mon, 26 Feb 2024 09:50:15 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=pankajraghav.com header.s=MBO0001 header.b=s1FvJLOV; dmarc=none; spf=pass (imf13.hostedemail.com: domain of me@pankajraghav.com designates 80.241.56.172 as permitted sender) smtp.mailfrom=me@pankajraghav.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1708941016; 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:dkim-signature; bh=i9yxkr7ZYzLuGR2ramAYSlLdnRgu3ddqhwDDXgb/dQg=; b=lDkSvVr4EITWxAt0lfHCWqhW12uIBINhpBQuSEB+rXMa74jpKZrtZQEtkYNdGltCqi6L/g MTW7a9AkPRarT5xBVaC1xNXZJ/1q5I4BZvAIaEDkI+Rf8GUcOixVEHmYh69b81gIu/HLZR I7MWSShW3X+7cUtDyFIQJKBk+R7/a9I= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=pankajraghav.com header.s=MBO0001 header.b=s1FvJLOV; dmarc=none; spf=pass (imf13.hostedemail.com: domain of me@pankajraghav.com designates 80.241.56.172 as permitted sender) smtp.mailfrom=me@pankajraghav.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1708941016; a=rsa-sha256; cv=none; b=7H3wo6LK3UdXBpgTNPSSLTyC08/o7XIEV6lOQMlOzqSgry0Yppa0h8rZxjcEHbRVHwulFs Ia8F0UNuKvj3L/BqWEF3rKhSvEK2hrdpIhDenPJqfB3SfdrMX7j9XGul3lv2r23EpSWf1d tIfwIwNSgmpptOdl/sqJTvenqyG8GUo= Received: from smtp2.mailbox.org (smtp2.mailbox.org [10.196.197.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-202.mailbox.org (Postfix) with ESMTPS id 4TjwpD4yqgz9sQ6; Mon, 26 Feb 2024 10:50:12 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pankajraghav.com; s=MBO0001; t=1708941012; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=i9yxkr7ZYzLuGR2ramAYSlLdnRgu3ddqhwDDXgb/dQg=; b=s1FvJLOV6O9BDoEZy9rfAWAdOmTdsY69l/3r70AQ4MWdtRAAjRw8jrLMD2N1T8oH7bb3FE Zo5P5AF31/WRErUzGHULK/N/M18PaNHpCSVQ/5UjkSyvUBhL6ARcSVNtDNa7LFFihtGyuX zwLRbtKGFial2tfZRA/t6m9w4WUIikd/uSVFERTvKPvVNwLbAywF7r57ufmFDElaWknTj8 dQx12H3rSonr9IpI4qrobmgSjtp6J/VscSXIGgYelBUaxhicKdv9lyM5eovuOQEre1YR3i LWU2h+G8ukjtVd6mKiPDMISh406FjzorZrXGDipZ54XIyY/I6PB1osHX3sl0NA== From: "Pankaj Raghav (Samsung)" To: linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org Cc: linux-kernel@vger.kernel.org, david@fromorbit.com, chandan.babu@oracle.com, akpm@linux-foundation.org, mcgrof@kernel.org, ziy@nvidia.com, hare@suse.de, djwong@kernel.org, gost.dev@samsung.com, linux-mm@kvack.org, willy@infradead.org, Pankaj Raghav Subject: [PATCH 07/13] readahead: rework loop in page_cache_ra_unbounded() Date: Mon, 26 Feb 2024 10:49:30 +0100 Message-ID: <20240226094936.2677493-8-kernel@pankajraghav.com> In-Reply-To: <20240226094936.2677493-1-kernel@pankajraghav.com> References: <20240226094936.2677493-1-kernel@pankajraghav.com> MIME-Version: 1.0 X-Rspam-User: X-Stat-Signature: gfeym345i1ephyzyyqymfzetsj7m4pu6 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: C334620013 X-HE-Tag: 1708941015-669087 X-HE-Meta: U2FsdGVkX18fRPqXLTjCvPfJD2u7pDu8ee3t+ODMrdR9UKclzBlHsHhYt1ivnr2/yrkst/borZdob4ejVNSLoibdcp/8s9Ik3LD1Sf360XHiAJExgiBSN9QrH6vdwED2tYG9vGRWRu4exleWGFCCAUuHHHfU00+BnNYNIC45zg0hAXn24oYjXwi6g6GF4w0RRSticPimnF2OuroV5MfxJUt8astYVYXinz1zTy9qzS0sdKaTnJSy9/MgIQxkuCzFCjZjp5y9I4P8NCn/MmwC/HS7Snc08KbYmbZ+RqLd/dAj3zuJDvCq3qOxP5P2wOMO7TH3gzuHxT6gPkp+g7af/rD4KD2W5dqUfCovngq9Ula/jH+OwyeKNRKjFUmq2m+W7Rxt2Lz2GpX2rifeudGAkTSRiyG472MBhtZUg+JNDWuPLcBXzUDWBPAAURazYhYBIqyl2gslair8IHejNy5eXeBjyGHrW9X3+dQbd+tjs6/nimaJjCqPMG619swb4p2qLdFOZSF1L7ckdokZXqQUxv/8+jBJCBNpOMwWZqWslowWjX76yGDVltjkpDhlULsTYR+Zzq4SDjjqrdzvbNp+SfZwdAJ7qsPTU+lFe7APNxrd71D1R5PgCs5Wjx5PrzZ9I9MtaAx1STT0llPS6c5RMjePd2EAsiUGlpzPbp8eashB1aEiR/PQJfR1LjjRsAJwhxsneJx4esOUyzbiuOtTsM1aUtVHfDHZnGouUgPJuZVX5bYRLVVPwmQPnbzm5Qid63d7kn/0o/S9vB44fUMKnNh533yqg0Z9V72F9BL9+ZDNTtQluNloAD/OrJOqsmQImpYfLZYHjQTxbhfeQMZQIfpWfaF3/uYWxeXmPiWZCkVtyzD8ILhJ9VeMpPqtrh9L3XUQW39qWEVhmnkv4+VWcC8x+aHK+5TBiqleNcfIouIhnaUM8oktImwBcktvkD7GHWk5E3cMFRnhB7AKzFG 0njrXUH2 pPSrUhht1SqkOcYWxHfhWoIsdO9VGI3bBc25zZKqqWkSZp4zNZt/x8XLofMEvIxix7glCQQw9w4WJobvPyd5BQTTKghZvjMgnW1vRczW9JzhKfLE= 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: From: Hannes Reinecke Rework the loop in page_cache_ra_unbounded() to advance with the number of pages in a folio instead of just one page at a time. Signed-off-by: Hannes Reinecke Co-developed-by: Pankaj Raghav Signed-off-by: Pankaj Raghav Acked-by: Darrick J. Wong --- mm/readahead.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/mm/readahead.c b/mm/readahead.c index 325a25e4ee3a..ef0004147952 100644 --- a/mm/readahead.c +++ b/mm/readahead.c @@ -212,7 +212,7 @@ void page_cache_ra_unbounded(struct readahead_control *ractl, struct address_space *mapping = ractl->mapping; unsigned long index = readahead_index(ractl); gfp_t gfp_mask = readahead_gfp_mask(mapping); - unsigned long i; + unsigned long i = 0; /* * Partway through the readahead operation, we will have added @@ -230,7 +230,7 @@ void page_cache_ra_unbounded(struct readahead_control *ractl, /* * Preallocate as many pages as we will need. */ - for (i = 0; i < nr_to_read; i++) { + while (i < nr_to_read) { struct folio *folio = xa_load(&mapping->i_pages, index + i); if (folio && !xa_is_value(folio)) { @@ -243,8 +243,8 @@ void page_cache_ra_unbounded(struct readahead_control *ractl, * not worth getting one just for that. */ read_pages(ractl); - ractl->_index++; - i = ractl->_index + ractl->_nr_pages - index - 1; + ractl->_index += folio_nr_pages(folio); + i = ractl->_index + ractl->_nr_pages - index; continue; } @@ -256,13 +256,14 @@ void page_cache_ra_unbounded(struct readahead_control *ractl, folio_put(folio); read_pages(ractl); ractl->_index++; - i = ractl->_index + ractl->_nr_pages - index - 1; + i = ractl->_index + ractl->_nr_pages - index; continue; } if (i == nr_to_read - lookahead_size) folio_set_readahead(folio); ractl->_workingset |= folio_test_workingset(folio); - ractl->_nr_pages++; + ractl->_nr_pages += folio_nr_pages(folio); + i += folio_nr_pages(folio); } /* From patchwork Mon Feb 26 09:49:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Pankaj Raghav (Samsung)" X-Patchwork-Id: 13571766 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 C070AC48BF6 for ; Mon, 26 Feb 2024 09:50:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4F2F9940022; Mon, 26 Feb 2024 04:50:23 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 4A279940014; Mon, 26 Feb 2024 04:50:23 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 36A61940022; Mon, 26 Feb 2024 04:50:23 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 27C26940014 for ; Mon, 26 Feb 2024 04:50:23 -0500 (EST) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 050874074C for ; Mon, 26 Feb 2024 09:50:22 +0000 (UTC) X-FDA: 81833484726.13.74C43A5 Received: from mout-p-201.mailbox.org (mout-p-201.mailbox.org [80.241.56.171]) by imf19.hostedemail.com (Postfix) with ESMTP id 3D3F81A0013 for ; Mon, 26 Feb 2024 09:50:20 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=pankajraghav.com header.s=MBO0001 header.b=KD2XCj9V; dmarc=none; spf=pass (imf19.hostedemail.com: domain of me@pankajraghav.com designates 80.241.56.171 as permitted sender) smtp.mailfrom=me@pankajraghav.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1708941021; 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:dkim-signature; bh=iQD+U8fQrLibnL7zMC26FszgKpFB3C91GewFjdSXc68=; b=qjv/951WTIax7o9YyZ1xraBuDFuyUjsiApaN4PHca4nThqLQGBD1lLzL2QsgFE6xWH70Qj irGYcTCfyzRRveq1VnKlUoty2slefEavkDLlfDiCbgCIqk7hjyKrKG1pp56kUDaEN8nj1b 3bjoNTArRAzEcbpBzFoSEQ97wMuTWV0= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=pankajraghav.com header.s=MBO0001 header.b=KD2XCj9V; dmarc=none; spf=pass (imf19.hostedemail.com: domain of me@pankajraghav.com designates 80.241.56.171 as permitted sender) smtp.mailfrom=me@pankajraghav.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1708941021; a=rsa-sha256; cv=none; b=FzWDVRjBuN7wGd8wgi7oYtxS8eyHsnDB12DJ8k5xNBRY2XC+oNVATpdQOPhS6RaLgXl83X SjEmoyCvN36BE73C8+8ZTfcNHeur/+7kg9SacXXSlV+Ae+bhf40cABNJOaL/H31PByAyEX oUdQEYQyW82s5e6CtaW/VkE4h83qmzs= Received: from smtp2.mailbox.org (smtp2.mailbox.org [10.196.197.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-201.mailbox.org (Postfix) with ESMTPS id 4TjwpK6z92z9sZG; Mon, 26 Feb 2024 10:50:17 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pankajraghav.com; s=MBO0001; t=1708941018; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iQD+U8fQrLibnL7zMC26FszgKpFB3C91GewFjdSXc68=; b=KD2XCj9VwH1Vmpc+ALJcr0/VQKCCQPTIil6owvpnHMNdIMgpDQ5W7a/HRkd3U4cOUjMCX0 I4cJnFFlwHSCV4Gbv2el17sDjgFvxM7cdzOZPo6QJ8vgcX2taBay3wltwWNxNcF3U5fNAJ L8WPmXdMxUgfXsQGWdlIcNLiYx0iBLpwGhhhEwubhYtDui7L8T/F+UPO5HJSx9SAcTtUtj FTQyNmAv5jqbNtdJ8Jzm5aGVJPAxwFkT36Nxj00z87HVHNTkqX+nYD5rBwtUg1Tiwon+Z2 YDfHCR6EtjB97Z3JdcRcZz++fzTQZzvFdjIDjH+KLPVowAREtTyhjqfTTaSEJA== From: "Pankaj Raghav (Samsung)" To: linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org Cc: linux-kernel@vger.kernel.org, david@fromorbit.com, chandan.babu@oracle.com, akpm@linux-foundation.org, mcgrof@kernel.org, ziy@nvidia.com, hare@suse.de, djwong@kernel.org, gost.dev@samsung.com, linux-mm@kvack.org, willy@infradead.org, Pankaj Raghav Subject: [PATCH 08/13] readahead: allocate folios with mapping_min_order in ra_(unbounded|order) Date: Mon, 26 Feb 2024 10:49:31 +0100 Message-ID: <20240226094936.2677493-9-kernel@pankajraghav.com> In-Reply-To: <20240226094936.2677493-1-kernel@pankajraghav.com> References: <20240226094936.2677493-1-kernel@pankajraghav.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 3D3F81A0013 X-Stat-Signature: tqb935amb1p7sh5b6ikq7dik3dp7s1pc X-HE-Tag: 1708941020-682361 X-HE-Meta: U2FsdGVkX18niL311ii1DfNtPHTfxezLQgbQLaL/tbIM3qhjP9dE8G/AI3j+MpRp3bC19BUIFlcnDabV91795OlN0caVOu13pRr42dEBIVdkhQA5zDO6Exjpr10o7yQ4HP8Mcq0WVZFWxJWJnY+vnaDK45Pkg9eVFDI0OCUdXbQMaMbR6s+GxShE2JB7qijBV1fDYHo7Tr8M5qJ70n3NueGcmI8vE9r0EHArw7unpOlSfN6DiNgyCGTATUzl24pvFuqAnBFFBADPfoytAr/L3cSAV+uxerVQKAkmsylQTdcw1crbFrlzK7ByGsBJK81dUPBjQaEw/4uaFm5F8Z88cJhBSMNRdUCXQTe4FKTYsQcp3OPsMH22u9GUkg51Y0aErLFVrtxjxMbRPW6ZUH44iK9uL9WZY6VambXsc/mnVAJFodO2Q5nTEu8aNXyYiErnzpSp6mjwfaB/v3lBmnx3E3Zp/1QxsvhoUmqzB/NX8P5S/s/Gr1E9n41TvObjvYg3JR3hWmRkqJuV6RNUGZLa2kB1PeAp7wmqCYodYDDiKBDKg5dw5ILIB/pY7oWAVxpY3bDTmsYExb+DDI3tZ9FSBKumjCjQTErOA40b653ACAJxEEds1QxaTV4DgKlfBXNHCzSWoRI5MSWRWuNQQjOGG9pjuLeISJ5d3hdHKO7RpoCGDK8Ny9NCPehfm9yNCL3q05ZFzFAGZMWquqqU2Ym3DPVpyA8u4lPm9Akg79jXR2ma/1GsQpkR8y5EAZozFU2eLHtY86bM5uqhBdGwAxvlYRQ+32BEBW2jg5b8NTptZOdLYvg9xHnOOmKPfJq5ihm/sr4+05FtiLDbEJKUcFQyA6vLD1SpYH7iyGbeDZzv/Tfc8g6eaU3/8BAC1OE3wMdIxeErgpzSszLRmG2TGgKLhQk8jXV9Ed9mOJtdCBXALr9lyzdAYoQLw5ZpyHVHTEgDBoczrX8JZXeowN8uumv T0XVTQoa fXau3ED1CB4QBDz+i2pXCJe4xOkLHDL/caaId0iw8C5k9/1dHAKsr/sTpLEbyqwT6kVf5MRDSk957NmfMRZZu9wHjGPUsqsMtOI5VbNOWN4h7aJMmFyJaJP3eeNU6JYgLF4aoSWxvTlwabnw2yiPQIIXfmnYMDuK58Lh0w7zp3m4tP+zNNCKDGgH9SI/3jwzezskRQCawjFnsPftFsp7OYgw6p5NCK7Cs8sggjTgM9lsVR4eQvSS+ZxRtDQ0BLhq693gKXkJp5DCRkS4H07bkVgHTxETgTvPeA+RrZ9g8qvyivax6B/5M5/TML85UoXtX1lRmjviHn/B07DtGHTQWj2GQjzUXEm2oyxjIivDaJWYrxJLVRoasvD3YGtF/aoNuWNYLXlDJAGFMF5aAkiY5OfYc93gY93LClKJS 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: From: Pankaj Raghav Allocate folios with at least mapping_min_order in page_cache_ra_unbounded() and page_cache_ra_order() as we need to guarantee a minimum order in the page cache. Signed-off-by: Pankaj Raghav Signed-off-by: Luis Chamberlain Acked-by: Darrick J. Wong Reviewed-by: Hannes Reinecke --- mm/readahead.c | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/mm/readahead.c b/mm/readahead.c index ef0004147952..73aef3f080ba 100644 --- a/mm/readahead.c +++ b/mm/readahead.c @@ -213,6 +213,7 @@ void page_cache_ra_unbounded(struct readahead_control *ractl, unsigned long index = readahead_index(ractl); gfp_t gfp_mask = readahead_gfp_mask(mapping); unsigned long i = 0; + unsigned int min_nrpages = mapping_min_folio_nrpages(mapping); /* * Partway through the readahead operation, we will have added @@ -234,6 +235,8 @@ void page_cache_ra_unbounded(struct readahead_control *ractl, struct folio *folio = xa_load(&mapping->i_pages, index + i); if (folio && !xa_is_value(folio)) { + long nr_pages = folio_nr_pages(folio); + /* * Page already present? Kick off the current batch * of contiguous pages before continuing with the @@ -243,19 +246,31 @@ void page_cache_ra_unbounded(struct readahead_control *ractl, * not worth getting one just for that. */ read_pages(ractl); - ractl->_index += folio_nr_pages(folio); + + /* + * Move the ractl->_index by at least min_pages + * if the folio got truncated to respect the + * alignment constraint in the page cache. + * + */ + if (mapping != folio->mapping) + nr_pages = min_nrpages; + + VM_BUG_ON_FOLIO(nr_pages < min_nrpages, folio); + ractl->_index += nr_pages; i = ractl->_index + ractl->_nr_pages - index; continue; } - folio = filemap_alloc_folio(gfp_mask, 0); + folio = filemap_alloc_folio(gfp_mask, + mapping_min_folio_order(mapping)); if (!folio) break; if (filemap_add_folio(mapping, folio, index + i, gfp_mask) < 0) { folio_put(folio); read_pages(ractl); - ractl->_index++; + ractl->_index += min_nrpages; i = ractl->_index + ractl->_nr_pages - index; continue; } @@ -503,6 +518,7 @@ void page_cache_ra_order(struct readahead_control *ractl, { struct address_space *mapping = ractl->mapping; pgoff_t index = readahead_index(ractl); + unsigned int min_order = mapping_min_folio_order(mapping); pgoff_t limit = (i_size_read(mapping->host) - 1) >> PAGE_SHIFT; pgoff_t mark = index + ra->size - ra->async_size; int err = 0; @@ -529,8 +545,13 @@ void page_cache_ra_order(struct readahead_control *ractl, if (index & ((1UL << order) - 1)) order = __ffs(index); /* Don't allocate pages past EOF */ - while (index + (1UL << order) - 1 > limit) + while (order > min_order && index + (1UL << order) - 1 > limit) order--; + + if (order < min_order) + order = min_order; + + VM_BUG_ON(index & ((1UL << order) - 1)); err = ra_alloc_folio(ractl, index, mark, order, gfp); if (err) break; From patchwork Mon Feb 26 09:49:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Pankaj Raghav (Samsung)" X-Patchwork-Id: 13571767 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 2343EC54E49 for ; Mon, 26 Feb 2024 09:50:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id ABF82940023; Mon, 26 Feb 2024 04:50:26 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A6EAF940014; Mon, 26 Feb 2024 04:50:26 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 90FDF940023; Mon, 26 Feb 2024 04:50:26 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 7DBD3940014 for ; Mon, 26 Feb 2024 04:50:26 -0500 (EST) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 4E3CF12072C for ; Mon, 26 Feb 2024 09:50:26 +0000 (UTC) X-FDA: 81833484852.23.A2CC804 Received: from mout-p-101.mailbox.org (mout-p-101.mailbox.org [80.241.56.151]) by imf01.hostedemail.com (Postfix) with ESMTP id C1F6740003 for ; Mon, 26 Feb 2024 09:50:24 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=pankajraghav.com header.s=MBO0001 header.b=lioYz3tH; spf=pass (imf01.hostedemail.com: domain of me@pankajraghav.com designates 80.241.56.151 as permitted sender) smtp.mailfrom=me@pankajraghav.com; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1708941025; 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:dkim-signature; bh=F3Xg5bE7lOUEiWrLgvJkawBGempm7FqinU/8gfujPB8=; b=Fl7mX8C4ri2H42Z4qaknARYN/YfsohHzVNywwjt6F6x0kkAlqOsL2XWFNamL/kpMWGfDCa nC87OFduNTBZpKvsF9IJ0s/Zg9pe5QK5NTg9wEitNCY7Ip4wTApDrXJW1DzV6HRo6lkn5p BPskb/YMx19qgdr2f2/YgLTC/MNZdfA= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1708941025; a=rsa-sha256; cv=none; b=ejzoJ7NllI+i9xzIfzXF65Lci8Upc9gFswTR7+HWblum9uyTynycYAIWYLYdt/MKPeocDj PSd8oVMyoxIfuvQjKFZ/HmAt1nKC8ZXUrY5eMLdyaTYnYfvuIOJ9hHQcFGY0EfKd7SFmqa DbLrqE8mU+B2myvYCviyoIbGklJPLdE= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=pankajraghav.com header.s=MBO0001 header.b=lioYz3tH; spf=pass (imf01.hostedemail.com: domain of me@pankajraghav.com designates 80.241.56.151 as permitted sender) smtp.mailfrom=me@pankajraghav.com; dmarc=none Received: from smtp202.mailbox.org (smtp202.mailbox.org [10.196.197.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-101.mailbox.org (Postfix) with ESMTPS id 4TjwpP5mYxz9sTv; Mon, 26 Feb 2024 10:50:21 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pankajraghav.com; s=MBO0001; t=1708941021; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=F3Xg5bE7lOUEiWrLgvJkawBGempm7FqinU/8gfujPB8=; b=lioYz3tHK8mjB7lKM1lOktEID4fLFlKa66xI9EIqMo9+mkBUeo8GueQEQuC6zRm8ZamQP7 YK5fiGlW4NBkooEUgInJLZGSECi/OX9C9RUl0wh7Uw+csnMhp4o1l1O/k7whwdYIjgCop2 G84nRQMuLf03YLlcgRix64u5MIviQ4C/cbo97lzDga4/0uiYD16VdRZByvCGW9ojfUJhEw ZfZvn0h4fRtSSxdNeA2wX+DyJIue/KNcckCgmlUXE54kwz+qVZKW26w+EIO37eSWQ2RTTj VvnAkngviyrXkfpus7MhYeIbM9ltg0nQQ8kub4GjpwHQPENVApoQGJJDkw8Q4w== From: "Pankaj Raghav (Samsung)" To: linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org Cc: linux-kernel@vger.kernel.org, david@fromorbit.com, chandan.babu@oracle.com, akpm@linux-foundation.org, mcgrof@kernel.org, ziy@nvidia.com, hare@suse.de, djwong@kernel.org, gost.dev@samsung.com, linux-mm@kvack.org, willy@infradead.org, Pankaj Raghav Subject: [PATCH 09/13] mm: do not split a folio if it has minimum folio order requirement Date: Mon, 26 Feb 2024 10:49:32 +0100 Message-ID: <20240226094936.2677493-10-kernel@pankajraghav.com> In-Reply-To: <20240226094936.2677493-1-kernel@pankajraghav.com> References: <20240226094936.2677493-1-kernel@pankajraghav.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: C1F6740003 X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: 5ywg13yk45u7b4q63p17nr81hxagrj7r X-HE-Tag: 1708941024-215152 X-HE-Meta: U2FsdGVkX18CRIslwmmwKYth2RE0CHtCrDfpasdx/q77D06PSm27y/MUIkQdt5xDXbdiAJ7Sh2POV2PzqX2SP8K1RqQWcvshrN4nmfcbkizCwbzvHXGAzXF7z7HzIb053ApkAzKo6Ren6rbRnFauoAD16DrhI2hXvP2EKkYRnO1lbK2Ui5ZLAuSBWE19N8E5pz1GIQtY6qN/jxfR9E623ipYKqq630O9PRAZBlZMaHtHTAccAq77+09AE0+wsYa1X+G3HFQeeQbTfC1OkWO49yRlhMFxpZthibc+gEf7ar5Qo9gtYSh2Hi/H89Ur+yYf3JcUO4583+aAsTRLpkLoPLSpJp4joSJJNfAEHx5+jWpJVWrGMT8oPu//GKW9XYu6MQuQTrjjpCLbsOxrhHcqKNrW3dUVRWg4P4eYyib+ecllKXubhSkj1xoIVnRfpEJ9XOL7N/6doedHxgjIoDWSZa69jB11WBS6THyHVVmxjw19j5ocwRB93C1I5u2wKSeW8E8JGZcIl/WWV/P8LP+0uBniKyeTOe2fT6uR2go4bqfELsfg9mImIA3y0XY9j9GaBn1XpMAhXlXapbMUS9KK3O7VwEJVZ4YtD2FnEnF957Qn9sW6x/6s3VNgUcdPG2zqNiTRXdhdboVZ7StC4Mx29ir0w7lW9fwWpAV/+vuqOkoNHU0BoM6Hv/GaTBXcbVE4Qedjec73/u0M/618XctitHsJfiJjBipPR8km/PeLK4mHuIK0YvMSTwAgpQZdQna+nerd169BeDG6tEIb1pwd3yrTm1i/ZqLv4K5Df7lcNBD08IdG1s+aunXCjOmEVTES8ZsIWLbJ18vGc8Q907+h+oLwhjAHKU9jMwWwcn7Lq9cre60bq1py/stz+5fgcWTE6i43vdAngyC6sGI1peVxrPpDFo+Sdbc5QGjWjppvMjKIdVbndEVypMdahJEb8fZGCuTvsKU7Zhcbs9xr2oQ OLO24yew 1JcfETnKr/T1E1/AiQ4rzIRKU6nU/P8H/tD/h41S6xVi7FXOUv2HpcwP/BS5laJGFCto2 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: From: Pankaj Raghav As we don't have a way to split a folio to a any given lower folio order yet, avoid splitting the folio in split_huge_page_to_list() if it has a minimum folio order requirement. Signed-off-by: Pankaj Raghav Signed-off-by: Luis Chamberlain Reviewed-by: Hannes Reinecke --- mm/huge_memory.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 81fd1ba57088..6ec3417638a1 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -3030,6 +3030,19 @@ int split_huge_page_to_list(struct page *page, struct list_head *list) goto out; } + /* + * Do not split if mapping has minimum folio order + * requirement. + * + * XXX: Once we have support for splitting to any lower + * folio order, then it could be split based on the + * min_folio_order. + */ + if (mapping_min_folio_order(mapping)) { + ret = -EAGAIN; + goto out; + } + gfp = current_gfp_context(mapping_gfp_mask(mapping) & GFP_RECLAIM_MASK); From patchwork Mon Feb 26 09:49:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Pankaj Raghav (Samsung)" X-Patchwork-Id: 13571768 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 98FECC48BF6 for ; Mon, 26 Feb 2024 09:50:31 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1E7FE940024; Mon, 26 Feb 2024 04:50:31 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 195E0940014; Mon, 26 Feb 2024 04:50:31 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 00EA3940024; Mon, 26 Feb 2024 04:50:30 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id E3008940014 for ; Mon, 26 Feb 2024 04:50:30 -0500 (EST) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id BDA39C07DD for ; Mon, 26 Feb 2024 09:50:30 +0000 (UTC) X-FDA: 81833485020.01.EBB8EC4 Received: from mout-p-201.mailbox.org (mout-p-201.mailbox.org [80.241.56.171]) by imf17.hostedemail.com (Postfix) with ESMTP id 2F5AB40018 for ; Mon, 26 Feb 2024 09:50:28 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=pankajraghav.com header.s=MBO0001 header.b=ftPcgErq; spf=pass (imf17.hostedemail.com: domain of me@pankajraghav.com designates 80.241.56.171 as permitted sender) smtp.mailfrom=me@pankajraghav.com; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1708941029; 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:dkim-signature; bh=CoSlfuEyGkiaGErrLwm5tBbxdIgWjqVT8F2G+alxKAU=; b=EsD2C5aTpyQ9F59C7+oMuBPC+zkPm5tXDu06owfCznipcZIrwVHg87O6o2YtyP2JEBNFTF frqxIdsCPZc+G16bzbZQ5gAVAr7Wo/JXI4Sotuq6zCSNiIFoqVh+XvrsDfpXlgHaTuRBtF uWk6SQNpGWsSYh18+8JGK1KQTIidjnY= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1708941029; a=rsa-sha256; cv=none; b=2+bJuloBaR8s+7LHJUE6V6r7VRommuTy2Y/m+9sxqaoVUEi/0aJYXlUBM+eTIU3mRAmH0N dZuOfd9Wv2MGHuHKsYsVqUItDjEbOlIGwXgT8+WWW6cAJ9EdG9aehQOfWbKOnypw0ynZ5J /2uBwD2dT/0nEzTg2wzYbS2Ynitsk0k= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=pankajraghav.com header.s=MBO0001 header.b=ftPcgErq; spf=pass (imf17.hostedemail.com: domain of me@pankajraghav.com designates 80.241.56.171 as permitted sender) smtp.mailfrom=me@pankajraghav.com; dmarc=none Received: from smtp102.mailbox.org (smtp102.mailbox.org [10.196.197.102]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-201.mailbox.org (Postfix) with ESMTPS id 4TjwpV0ZL1z9ssH; Mon, 26 Feb 2024 10:50:26 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pankajraghav.com; s=MBO0001; t=1708941026; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CoSlfuEyGkiaGErrLwm5tBbxdIgWjqVT8F2G+alxKAU=; b=ftPcgErqnPBTbun/dhyU0NKfoVEkMjjZg0CZNyhDa1KTOioigQfA3tSxToEOkKPQT/5uVW CEY6E5/8D+UDJP+TbD41sLzkafb7BBOKarhRvsqEpaL3/dvCB7+HuFndTFm+FosZeS0VQl h4YFFeZ/Y+oZy/EKgfiAs1/xt1ctY/D6Fjyj/FcCTutVY6I2tpKMSKZ5oAox1iVPEfEzBX WpNNRQKPXKgxbceDl4iniriCVCxFMh9t7y74jc8ICR+vUH/CIUoQtd3pG5pxH9Qm8gddRV m/HS4ri7tPBppNTTqo7BDAzkBzabfNdsNicJ8dOItqWJP3LIMduq7kYp7b2sPQ== From: "Pankaj Raghav (Samsung)" To: linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org Cc: linux-kernel@vger.kernel.org, david@fromorbit.com, chandan.babu@oracle.com, akpm@linux-foundation.org, mcgrof@kernel.org, ziy@nvidia.com, hare@suse.de, djwong@kernel.org, gost.dev@samsung.com, linux-mm@kvack.org, willy@infradead.org, Pankaj Raghav Subject: [PATCH 10/13] iomap: fix iomap_dio_zero() for fs bs > system page size Date: Mon, 26 Feb 2024 10:49:33 +0100 Message-ID: <20240226094936.2677493-11-kernel@pankajraghav.com> In-Reply-To: <20240226094936.2677493-1-kernel@pankajraghav.com> References: <20240226094936.2677493-1-kernel@pankajraghav.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 2F5AB40018 X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: hwxgyb88etqd7sgb9kyrunj6cegup73a X-HE-Tag: 1708941028-548276 X-HE-Meta: U2FsdGVkX19Pq1f9v8KrCfsVjO2vuSijAuTVIQAj5PDCyl4nBMOJmY0Ln5SgqOlO1o7XYW0r1SdCej9O0gDhB60MQXuHckCD0wcGUBNI5bbeZD+Jczh/b4QMZC+oM3JjS5r7voyqDBB1LcIyHB4u3PXn6kaoIGlkjCrvqLl3H411Ziw8fkbm0Pk0wfsLR7Cybxd5I1ebx+dqFJV1cCzW9BpniDELS/nk5/D6TzOB7zeramk7vDRw8ONS18k3/RiTQwuDmAcDvw9aEAdyEnhbHjYTThLUftY8DhC9v6gof8HgqFOEXncEweRpkYqT1SxhFuaezkRuaCKL9fnbHllKQO6oeW+o3oK57uyntBABGKxYRTx0zgIYfrNQCgNd8gN8go3d50WENfX18Jg6ceetJk54GvTG+TjZ1nZT91ioeZC3si18DN07gvGMyrem6R9xS+rGIiTEs1MzQIDT0Hn+RJ7t0rWzjtB6jRaM5yz0XhwrAW+anJnbfO9t3XWAit33sY2ZwVp6OVEP5sQxpVuhgdpX2W8NLf+MDyVXsM72JqtG7KShIYWr8HRVZYrvLBCLX+bBEzCtQFgs1+jdRPtcVtn14UGyxAqWBFfvqTQqyimwA/E6uATER8Cq5F6JEHrjJh2dXd6sNQIa/EhAtx0KFQRix1XsSalQ200kKpz/4tHlJUKW+xUjXPi96mBIFHXXhKG+5yq8fWqVKi3W6PQl4WoSTqoHyRxs8P56osRmilkwvIAhbnW8vwZreRxEz8MQ5WCQAlEvIjhOTAsxdKJGl8EEOeIz2ovqgEcpIbmWyfB3PmpBFTXTyr4L3n4tgO5tGG4UYVeREjBMGMoNUrr2aeR8+WMMftT8wRyy9oEy2qGAnRphOMKF6qZc/Kd/D4+nPeePKouAvr/SYOimgZoJ4cT0/b+kdibhAyOUhLEBxnOT7eRI+4Zs4eUhRgXgwlMgYaHnUKhtrzADyibVFbl wQfJCXWx NXSJCvXYPFBSz8zLIdPZt4VCwhDeLdCPAnf5/7b3Ul1X37jne2wqYBPgxKurn6gABc+hGcZqnCKxKjETAEOyKfc0etJ7NYVfvPgSpcACaPUmJdbg= 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: From: Pankaj Raghav iomap_dio_zero() will pad a fs block with zeroes if the direct IO size < fs block size. iomap_dio_zero() has an implicit assumption that fs block size < page_size. This is true for most filesystems at the moment. If the block size > page size, this will send the contents of the page next to zero page(as len > PAGE_SIZE) to the underlying block device, causing FS corruption. iomap is a generic infrastructure and it should not make any assumptions about the fs block size and the page size of the system. Signed-off-by: Pankaj Raghav Reviewed-by: Darrick J. Wong --- fs/iomap/direct-io.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/fs/iomap/direct-io.c b/fs/iomap/direct-io.c index bcd3f8cf5ea4..04f6c5548136 100644 --- a/fs/iomap/direct-io.c +++ b/fs/iomap/direct-io.c @@ -239,14 +239,23 @@ static void iomap_dio_zero(const struct iomap_iter *iter, struct iomap_dio *dio, struct page *page = ZERO_PAGE(0); struct bio *bio; - bio = iomap_dio_alloc_bio(iter, dio, 1, REQ_OP_WRITE | REQ_SYNC | REQ_IDLE); + WARN_ON_ONCE(len > (BIO_MAX_VECS * PAGE_SIZE)); + + bio = iomap_dio_alloc_bio(iter, dio, BIO_MAX_VECS, + REQ_OP_WRITE | REQ_SYNC | REQ_IDLE); fscrypt_set_bio_crypt_ctx(bio, inode, pos >> inode->i_blkbits, GFP_KERNEL); + bio->bi_iter.bi_sector = iomap_sector(&iter->iomap, pos); bio->bi_private = dio; bio->bi_end_io = iomap_dio_bio_end_io; - __bio_add_page(bio, page, len, 0); + while (len) { + unsigned int io_len = min_t(unsigned int, len, PAGE_SIZE); + + __bio_add_page(bio, page, io_len, 0); + len -= io_len; + } iomap_dio_submit_bio(iter, dio, bio, pos); } From patchwork Mon Feb 26 09:49:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Pankaj Raghav (Samsung)" X-Patchwork-Id: 13571769 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 846ADC48BF6 for ; Mon, 26 Feb 2024 09:50:35 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 126EC940025; Mon, 26 Feb 2024 04:50:35 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 0AC85940014; Mon, 26 Feb 2024 04:50:35 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E8F9B940025; Mon, 26 Feb 2024 04:50:34 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id D4CD9940014 for ; Mon, 26 Feb 2024 04:50:34 -0500 (EST) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 7F6F68078D for ; Mon, 26 Feb 2024 09:50:34 +0000 (UTC) X-FDA: 81833485188.06.6C79782 Received: from mout-p-201.mailbox.org (mout-p-201.mailbox.org [80.241.56.171]) by imf18.hostedemail.com (Postfix) with ESMTP id CD0F01C000D for ; Mon, 26 Feb 2024 09:50:32 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=pankajraghav.com header.s=MBO0001 header.b=X9VroBu+; dmarc=none; spf=pass (imf18.hostedemail.com: domain of me@pankajraghav.com designates 80.241.56.171 as permitted sender) smtp.mailfrom=me@pankajraghav.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1708941033; 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:dkim-signature; bh=Zh8crSzzd1QnmeV1OcknR37ATkgZhCAIPO7aiRL4a8s=; b=lZpdiU79h9s61DBAMMmbhnwM8mf2U6NYlAoJ5L7pR3ZbZJm8wWnN/ymZhm5hQgzPLDCbwC pa2RMu54GW0tQQJQXZDtfoyvV0zsLMjwvbkzrEEOOHRKv12pUo1CDxeOtfEZWqUF/31H9E fgJQXEKRGhZVzN7eBL5m6JuttJL8JsY= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=pankajraghav.com header.s=MBO0001 header.b=X9VroBu+; dmarc=none; spf=pass (imf18.hostedemail.com: domain of me@pankajraghav.com designates 80.241.56.171 as permitted sender) smtp.mailfrom=me@pankajraghav.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1708941033; a=rsa-sha256; cv=none; b=n2p4ZKwvdQTtcT22hRy/DAYfPNOsgxSqlyVCw2vJuHUbW3UAOl1fFuza5X/J/faIifL5Wv HAGixCg+X9XASlo4rAJGcj6sWtx7eRenYMp5TNHIu3/MWSjP2q4qtks1qD2jF5ZMAO+6zn Bc1BJpUfeV9knBTVtZ6ZjNE7C4oyCh4= Received: from smtp202.mailbox.org (smtp202.mailbox.org [10.196.197.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-201.mailbox.org (Postfix) with ESMTPS id 4TjwpY6Hqyz9t0C; Mon, 26 Feb 2024 10:50:29 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pankajraghav.com; s=MBO0001; t=1708941029; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Zh8crSzzd1QnmeV1OcknR37ATkgZhCAIPO7aiRL4a8s=; b=X9VroBu+3yO5IgXXT944eaTQlnsCiIDYHWBS+LxO8jDzLeA9zPRPzGeQfbvBJBDt8oQVil 9z/Jroy3X9i5rjyglZl5s+1FojOZZK88Y+XGNkbBm8GWNmi28d75LAv2D11kpCozfKUKZs C/RtBKkXLZ42ChZZiXt/0ETwe/ylfB5qbLaywpGRm9QkT1pglMn9HnC2tkNPrKiyxtug7O zL8gNSCtEFROdxvnAcR3uWDZE1AYGHQUtXzOojhM9P4tfYwPQKgeUKqePIHm1/SFUPJKip 94vDoTelo97v9/BKF2OAD9svWm7Ox8jcJAUWYLurePCPkDU98tjP1ggrHhzjSA== From: "Pankaj Raghav (Samsung)" To: linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org Cc: linux-kernel@vger.kernel.org, david@fromorbit.com, chandan.babu@oracle.com, akpm@linux-foundation.org, mcgrof@kernel.org, ziy@nvidia.com, hare@suse.de, djwong@kernel.org, gost.dev@samsung.com, linux-mm@kvack.org, willy@infradead.org, Dave Chinner Subject: [PATCH 11/13] xfs: expose block size in stat Date: Mon, 26 Feb 2024 10:49:34 +0100 Message-ID: <20240226094936.2677493-12-kernel@pankajraghav.com> In-Reply-To: <20240226094936.2677493-1-kernel@pankajraghav.com> References: <20240226094936.2677493-1-kernel@pankajraghav.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: CD0F01C000D X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: uitm1t1a83j65eoebz1a1nqabhfoo943 X-HE-Tag: 1708941032-102604 X-HE-Meta: U2FsdGVkX18lIwjuniYjBhsYK3mWW/0hSRVYJ3dHODT4ZhyoYQgnqOZtLr7fa4TEg7YZb6UkjxaoyRFuuMUwrlC3r8QM1zcU7zWhiXvcr3RYcA0lpfcdjr5WfPBhdiJTHzPUJJZZyJUIPWlSsctHGhvOYjCsL4e0BG4bW+jEuTTRHE5h/7g19NKBaPsTHPN9pfaXWyMyNXk5xIn2bTmu9CzelPi4obhwQKmlT7gfrVkjFJzLgDCPtWBiddW2p/ejrWuXAgWIDfKHYIX3SAtz7Yixir6on2vpNYmXvGYuNzTmk4DOwM02XV7ZUIm/kPeI++v9zDZh2XWhqI+ezc51zUVWHQu2Usmn5ajv8giDt3M3WVGj/u8DwJbzuLKbBIpm43UaeQo8IE3Z6Dm8FHmryofx9stx6K/41bq/wYElF8ZjnrDWIwhSwV2v3treVvWgrbQzLcv/g8/ceYqCS1cbQDS862H6bENjT6WQn35Mju9GOEYXFP+xojj6ly1sdghhQ9LDmhLoudKIteoDFs3KvwNpJ3PH4jnuE7zTGF1pBrP78u3hylALfEymKvcTIs59Ygcon6bfsYUgf/tB4x49Dehs1FPa65e0CoWkSyb6Zv8j9VMhnXYxr8qbw8KRzop+sCEojlqL5RbwM2xfYk5Lnvv9IvILEEFWIgBzAbcrE/ALDZpFlMWcNmfKLiIrc92qWqVPTBDP3RwUThaCWCdPWi9vGQuhF6NM1/myxYpJwwbJ1K1Bmi+OXtNwyDSW8R6+I+82xeAJhFD0xgoQ+XL1wVtL4fhHt0M9IqXJ6Hl6HRbBCYFmnM23Jqz7V6BrDisNZHe0EgpU1hycNR+jZASkXLH60iRGDv4bmuMl+IWMH/+VUzHDeNYHIUiHdqWDTgoAsEm2UX8jLQHfTkQ9yiDrXL82TZBP+CP8ZnwTDw3PrRLFzSEqbuP18z8eQRqV8Wi2A6Hdq+FKXd+hZDzZCnq VNgPjPFd ZMXxrSNAhGgX+dRvtfi9MGqrRtUrfLhXEAz5y6thEMDEGZ3zfma2Fee1Ho1c95s7Cp7d1CVrS06ocZVJ7QwdX4S8cZQxj6kk5uI8SHHuZXiWLnzfQw0UHZuBbR8GLfwrjjznTCMrYOKfMfSbKrKobdQmv7x/B/VodD10m4tyokvTXbSyrclILfPtQXuoMgJLBwfkWVceRgpOvB9PHye1VW/in50//c7Yg4yo0+yGh5loz6ipq+aEPdaxFNEqNL3yqMNc+vbYX0CKaEWfeyy91tle5dLqF/qLKaqwm22ukYOPlWYw2Oc/VL7ybvuOaDy6mAmebKuc02lXMj/aHIkq0U4Y2POgaO7s/ueRru5xBYwIvlaFukNbyRMyt+g== 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: From: Dave Chinner For block size larger than page size, the unit of efficient IO is the block size, not the page size. Leaving stat() to report PAGE_SIZE as the block size causes test programs like fsx to issue illegal ranges for operations that require block size alignment (e.g. fallocate() insert range). Hence update the preferred IO size to reflect the block size in this case. Signed-off-by: Dave Chinner dd2d535e3fb29d ("xfs: cleanup calculating the stat optimal I/O size")] Signed-off-by: Luis Chamberlain --- fs/xfs/xfs_iops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c index a0d77f5f512e..1b4edfad464f 100644 --- a/fs/xfs/xfs_iops.c +++ b/fs/xfs/xfs_iops.c @@ -543,7 +543,7 @@ xfs_stat_blksize( return 1U << mp->m_allocsize_log; } - return PAGE_SIZE; + return max_t(unsigned long, PAGE_SIZE, mp->m_sb.sb_blocksize); } STATIC int From patchwork Mon Feb 26 09:49:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Pankaj Raghav (Samsung)" X-Patchwork-Id: 13571770 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 A99AAC48BF6 for ; Mon, 26 Feb 2024 09:50:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 36D39940026; Mon, 26 Feb 2024 04:50:39 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 31BF7940014; Mon, 26 Feb 2024 04:50:39 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1BE65940026; Mon, 26 Feb 2024 04:50:39 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 0812B940014 for ; Mon, 26 Feb 2024 04:50:39 -0500 (EST) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 892FA140715 for ; Mon, 26 Feb 2024 09:50:38 +0000 (UTC) X-FDA: 81833485356.15.346838F Received: from mout-p-201.mailbox.org (mout-p-201.mailbox.org [80.241.56.171]) by imf27.hostedemail.com (Postfix) with ESMTP id BFF6640017 for ; Mon, 26 Feb 2024 09:50:36 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=pankajraghav.com header.s=MBO0001 header.b=hAVlxzD2; spf=pass (imf27.hostedemail.com: domain of me@pankajraghav.com designates 80.241.56.171 as permitted sender) smtp.mailfrom=me@pankajraghav.com; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1708941037; 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:dkim-signature; bh=HlYEwWAE6vZZcw5JeU6SUv0SKwh4LwGux0locayr8EQ=; b=pPxrdyY1sUUYtukUrKwmByjZC0jMLSXL1aDWuyMHyuXYxVPtVKlIdYKuxHVKU9ngax8XYn MjAxSZ/D6rwLGLv3XWEX0bCeeccfib+I9ZjmOLv968gOgWIdt242lTYeX31R+3gDeoJvuO Jo96h18bj9m//3BgW5t1Jrzho3knkVA= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1708941037; a=rsa-sha256; cv=none; b=sga0OIN+Qi8Pfu+xCgFrPWRVsvWswR4Z2s0ACBdiIfWQjfFphzmD4q0T24cpAAenEa/AQe 7iJCjPBI5z7lh3MiTo6kZWidQ0TZWMtTAaOvs5JancN03Hufds/f57TXhIyNKpox05Kcsl Y1iIL0TqPAgpg5HdOJN7f9u796mV1LU= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=pankajraghav.com header.s=MBO0001 header.b=hAVlxzD2; spf=pass (imf27.hostedemail.com: domain of me@pankajraghav.com designates 80.241.56.171 as permitted sender) smtp.mailfrom=me@pankajraghav.com; dmarc=none Received: from smtp202.mailbox.org (smtp202.mailbox.org [10.196.197.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-201.mailbox.org (Postfix) with ESMTPS id 4Tjwpd5S1bz9sqr; Mon, 26 Feb 2024 10:50:33 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pankajraghav.com; s=MBO0001; t=1708941033; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HlYEwWAE6vZZcw5JeU6SUv0SKwh4LwGux0locayr8EQ=; b=hAVlxzD2LUL1rbpSWjPjfIWWZ+5drZJNxCuKnYF1eJy8lXLqGyC3JvVjJva165jpZA8JrK /NizHCJ/YjEL816L5LIhVDRvYkcIOLksj7bpIUgXlYkP3mVY1kr/aMoGEUbK03wka8yZ9S Sr6WVXmeCkUN9ZfZ97Ut4XQrp4ARMV4/DD2WK22lwFyIP5AfsEkvUGV3hnyVAFzwTdDNL0 Q5nftWFtgrFUeqMaxatl83Cq1koGPzuefYzt7zvoWkCPf69Ydn5PYfAqOWucArjj7RmCxM LPwD8UfbzpoS3DW1EujY+tdRK5i5lGBa24C8u4KLR8TX8md71im/pzk2XnBEsQ== From: "Pankaj Raghav (Samsung)" To: linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org Cc: linux-kernel@vger.kernel.org, david@fromorbit.com, chandan.babu@oracle.com, akpm@linux-foundation.org, mcgrof@kernel.org, ziy@nvidia.com, hare@suse.de, djwong@kernel.org, gost.dev@samsung.com, linux-mm@kvack.org, willy@infradead.org, Pankaj Raghav Subject: [PATCH 12/13] xfs: make the calculation generic in xfs_sb_validate_fsb_count() Date: Mon, 26 Feb 2024 10:49:35 +0100 Message-ID: <20240226094936.2677493-13-kernel@pankajraghav.com> In-Reply-To: <20240226094936.2677493-1-kernel@pankajraghav.com> References: <20240226094936.2677493-1-kernel@pankajraghav.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: BFF6640017 X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: n4ekc4q5bcz9ry4y4ihq8x1b9ou4ai5n X-HE-Tag: 1708941036-287264 X-HE-Meta: U2FsdGVkX186lVrwAyZzgiXY1vCEDtQ8plBbH9rF24LTY6qlwD4NRLmIvC/ufVhXhBboHO5L81DtVTCr7HLejjzWqyWlSfWvJK7M3Tne2A2VsDA0tQkb+VQ+EmsL7iSAlbwjHN6pZhX3DrL1ITAIQ6c0X3aWCG2DAS54TunW0KYQGinfXGPQnwOwIaf7lJWjM8Sa6prUGdJAmncy80Xc/7ngxbUYDhur0K1zeV6NCD3FgOjZD76YDQ9QhxX5rryw3m5uk83qlWjGOHw/GY80vebJTY+gLoR9EawbHnWCvA217ziCm3s8cq9wKqiyji3SVGPqMXsPlHJWh4/GovdpBXEKbWudb5cgbI8Aos6IqEjtlkLbQ02fdR1Oxvh94IwxBGCOUmK1bpxkl5aWH3SRVvtJQB3Fiw/Gho5UtwyuOSj/wqwkkOepqNT6Tlh61b8MuZYCxcI8eigfGR49w85k7cpCkHo2B5LMBTh5gtLNpuumOYYoxgc2c0BGKPN0z63Lwubjs1rxNU3qpIKGdmqXKCU6zAr4w/HvCRBGqvrVdQSvYDrQF9Knnvr8HLYMrt1noIXLvy0D8whPrJWoUCgwCIf0+zhNXFrifMjKqOPFe0tlBT9f/kXXOo3bsFTxcvzBZyEBk5r/bh74N4TVh08lyPolnsbIKezf663p8mImUOkGf2BGwc5nSREuYjeeMa9AnczY3eghN1DK00RbEeL4VxMnNtgv3/IjHK4UlUV35P9KzIufywOlkVdGBiL+Hf7pEn/TEWLUJ8Sl8OoJtCFU/pya2PSgF/c2eY7XHe+2GCK88FJUp5gZLI70OqO5UZ0woHIWFkjwm/vR45U7L5U20YqZMhJFuGz/l7veD6xW6XOuupcwPfgNLvZJNDa7jMaiQEOSWIbjxh3pO1pTJnahorpCNUhMwmeGhqe0WcD5Bjpq83bRNJYw4+l9h1pWxqQPLMiegi8TJxNJJoDpDT7 kJoYV+cY ZdZB3ELA2n9KH8wXdGcPOTbJz+Hl2E1dkT09nCLJoCN9f6+AqrchpRljtX7rL8vCVGHgw0twRNiWYies3dpvhUV5KyIFspm2oof0SMi4VBQ5OO139Iwa/JQtTexcoW1tMVStZuQjvK2qSm26KcnRE/gOkVVw6m4ZSWp+Rs913KiQN9cr6G7DelRNBTCxMrzQJsAksZ9d4dT8X1v5TLvumBlJ1nYJaWd1xAeQVHHuQgtMRf4KUxxaxWshRT7Y6QMZ5rr/RL6Y5F90jS9nq8wgYv5fWqDA8Q+vUVXNN5+vmtr2+WWRbhKoiNFSHlEJXRgMOXMxIrxX2SLSzdz+wrtoFK7/tLqKWzgVj44AeF9JPLnzYjrM= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000006, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: From: Pankaj Raghav Instead of assuming that PAGE_SHIFT is always higher than the blocklog, make the calculation generic so that page cache count can be calculated correctly for LBS. Signed-off-by: Pankaj Raghav --- fs/xfs/xfs_mount.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c index aabb25dc3efa..69af3b06be99 100644 --- a/fs/xfs/xfs_mount.c +++ b/fs/xfs/xfs_mount.c @@ -133,9 +133,15 @@ xfs_sb_validate_fsb_count( { ASSERT(PAGE_SHIFT >= sbp->sb_blocklog); ASSERT(sbp->sb_blocklog >= BBSHIFT); + uint64_t mapping_count; + uint64_t bytes; + if (check_mul_overflow(nblocks, (1 << sbp->sb_blocklog), &bytes)) + return -EFBIG; + + mapping_count = bytes >> PAGE_SHIFT; /* Limited by ULONG_MAX of page cache index */ - if (nblocks >> (PAGE_SHIFT - sbp->sb_blocklog) > ULONG_MAX) + if (mapping_count > ULONG_MAX) return -EFBIG; return 0; } From patchwork Mon Feb 26 09:49:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Pankaj Raghav (Samsung)" X-Patchwork-Id: 13571771 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 25550C54E49 for ; Mon, 26 Feb 2024 09:50:43 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A240A940027; Mon, 26 Feb 2024 04:50:42 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 9D4CC940028; Mon, 26 Feb 2024 04:50:42 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8267C940027; Mon, 26 Feb 2024 04:50:42 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 6EAF6940014 for ; Mon, 26 Feb 2024 04:50:42 -0500 (EST) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 510F11C05BD for ; Mon, 26 Feb 2024 09:50:42 +0000 (UTC) X-FDA: 81833485524.23.6B3A6DC Received: from mout-p-202.mailbox.org (mout-p-202.mailbox.org [80.241.56.172]) by imf16.hostedemail.com (Postfix) with ESMTP id 91EB818000D for ; Mon, 26 Feb 2024 09:50:40 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=pankajraghav.com header.s=MBO0001 header.b="r/dmaeu8"; spf=pass (imf16.hostedemail.com: domain of me@pankajraghav.com designates 80.241.56.172 as permitted sender) smtp.mailfrom=me@pankajraghav.com; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1708941040; 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:dkim-signature; bh=TxspCYGvd47S6sMZqiF8IxyiXSLrdsbW3Rzpn1A8oVs=; b=EulM5YpPDhCrMh5pcXU70gIVSUUMdwXGa9kmulIrkrWq+ztZDX2PqVoTv4ZNqAF1NH7+u/ NDtrm1nkqUNtX+Ys2WP98yoaYiFC7sq4PFNPNmCNkKx4itBGzQ0VD2IwouVU1IURcFm240 7siULBmZGpCODfDgfpXgjO5vcGdThcM= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1708941040; a=rsa-sha256; cv=none; b=JrANLiuMZcRop+CElhtqaV79wh0Y4ZT+LHJFknnaEYIWDU2/NHOzWp9YkVqJAn03v9LpMm 3RVf71uq5Rtjqc8SXeky36RS0g/jtQSra0N9DNTklamGKXrBQKMHI+N8frc1o6m/skzWY1 eo/rJeTwTdTTh6M5EjGXeBYP3/Ml/h0= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=pankajraghav.com header.s=MBO0001 header.b="r/dmaeu8"; spf=pass (imf16.hostedemail.com: domain of me@pankajraghav.com designates 80.241.56.172 as permitted sender) smtp.mailfrom=me@pankajraghav.com; dmarc=none Received: from smtp202.mailbox.org (smtp202.mailbox.org [IPv6:2001:67c:2050:b231:465::202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-202.mailbox.org (Postfix) with ESMTPS id 4Tjwpj3Lszz9sd1; Mon, 26 Feb 2024 10:50:37 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pankajraghav.com; s=MBO0001; t=1708941037; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TxspCYGvd47S6sMZqiF8IxyiXSLrdsbW3Rzpn1A8oVs=; b=r/dmaeu8ky0Zitwk6d/p71mCATrvYsjhMj+pqGiiXKmkR/JFZzQ4UzKBr1JYGDYt7Xmey+ 4YlsyGLVY0JeTsSAfX9QD8ohDznFOefXqdL91rLdcOIA0b1DC1jKooTiTD8P0N5Otpz96p FcEQHn9pTyCODOwN1oCWuNkBxQtVNSDXAYq2A1Cb7+uZg+SFwRAQhVuH+UxnnR2HHXDPnr lu6+d5f2UIJPqHRvfkqMvtKaGXc4xWYIrcigS98zQJZKP+4F+ZO7iCuF7Us0aVsFsSJ5W/ fzYF/GIvrVQbR8vvaMZ1Xxgb/Yz13ovRc4iCTJuTdI+c/VrA577/Qf+r01F9TQ== From: "Pankaj Raghav (Samsung)" To: linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org Cc: linux-kernel@vger.kernel.org, david@fromorbit.com, chandan.babu@oracle.com, akpm@linux-foundation.org, mcgrof@kernel.org, ziy@nvidia.com, hare@suse.de, djwong@kernel.org, gost.dev@samsung.com, linux-mm@kvack.org, willy@infradead.org, Pankaj Raghav Subject: [PATCH 13/13] xfs: enable block size larger than page size support Date: Mon, 26 Feb 2024 10:49:36 +0100 Message-ID: <20240226094936.2677493-14-kernel@pankajraghav.com> In-Reply-To: <20240226094936.2677493-1-kernel@pankajraghav.com> References: <20240226094936.2677493-1-kernel@pankajraghav.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 91EB818000D X-Rspam-User: X-Stat-Signature: 63d69mw776a9jpiz647ptd3z73njwcr5 X-Rspamd-Server: rspam03 X-HE-Tag: 1708941040-438525 X-HE-Meta: U2FsdGVkX18Tg3IHcoEUBjaKZqxlNR1nm+eadeMZ3WwK5eJxn9b+tPWUIePx6CSidn33eWCEIbmBAdjPu0CfvkusbdxJ46BGWLVAjDRf/B4KdYapT0aDhWgO1WdvNClnQFudnyxAJZFg4efdu+/DYSWoH/w9lLsdjqc2nNQc9CDGAReU7xLn0IWihuKJD+JZ4yjUh3DDLvikfyYWeksUS4/rd/nwUud8iiPszgDxpDUNelKc8v/uLdxH0rN4j40ubtCe0hRn+Deple7AF7rvoICet4aJl4UAtVbVvW6xsDRytrXGCVIB8OTgHXIAlm2m00tjEjZAMM5NXkdD1i943w/96VMd73SRA3kDEJfAXwjcBJaToitm/3EdTfbQUKDRaD5JyX9errgZuUMj4O8KU4pBs9xEVxxDVh7HM4qTmPGQtX3liZVKCkYtBIMXJIrJV2Ayj4Qkr6rkOt7z7NL4X0SebpdSPVtyax2erZO3FUAAgvHzPTxMQbHnfEJeJSGF9E8jK0iqinDibXhQUiMPKsUopTZNi7ug0YXNtoUMvZx3XTvi23qczir4FvLc7ePBI8kI6PP1sKJVBsMXEYvO3aTuFVEwIFKc0ZZD+fW+Ll2L7aoldDXnOrsrGqGG6kBU6MuHbtJOrFJviLv0LblyhDyDdTnUjZlHOpgCw4iMyj2zrofQcELqdINhOY6M4Nx69tSp3A8RPrcYOjOIHQVENiS55OY+Kue5++v0+OnbT4dyIPu5FEFywZBjRFlexF3hqnresFPAlQB/G1juYquZ20DzLhboVYUTtbk7YQrmwDdO6HxEcGTEMEVS8Xtisf+zzPvd+8z2sGc45i0SDZxa7TlaCLIxL5gRDfQf8jG4e8iEAzfPhgJD/DY3EbV6SwWAQiNLo2xitiQXdz4jcn28aquS93JW/8+pBOMVU7yFnGlqseZ7ASCtbyFtGATPVcIECPu8umBUlq8QXvRdKBw T5Mhn0kb hi/dTEgpkcfB9aCFdYbjA9Z1arZNGYF1Aic1W4HT+yFBBVgCgD3JVwex9alDjBsU/yhKuMm8gTMijdQggflyZphjRF0lCbkwZqeRq1vgoC5JJwD0v6Nff+qwhdOYWhsOLO0/Tnx6nWjYuRsx4ei0Q8nZFj9cShXuMvtdqNfqUFwyUBCz44dJBna5pNkKkxEbqzVunC+kW0rkEuzeLgzUrdavVWsU8tEq/sZVY0TfkfsZU1zNSF4cJ6UxqNqztOS5fDx2HGUxuPlj2r343pf5oMVYpa3I5RudyFEB2sO70466Qb7aAZtETpBFdGo93lSZZc/0hbxH8+KA3j51AoX9VJOFKoojkfKbssTqCQAz4gvJhOyPuxVGPjyvE5DeyEutS8MwER4awMJz7oUQ= 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: From: Pankaj Raghav Page cache now has the ability to have a minimum order when allocating a folio which is a prerequisite to add support for block size > page size. Signed-off-by: Pankaj Raghav Signed-off-by: Luis Chamberlain --- fs/xfs/libxfs/xfs_ialloc.c | 5 +++++ fs/xfs/libxfs/xfs_shared.h | 3 +++ fs/xfs/xfs_icache.c | 6 ++++-- fs/xfs/xfs_mount.c | 1 - fs/xfs/xfs_super.c | 10 ++-------- 5 files changed, 14 insertions(+), 11 deletions(-) diff --git a/fs/xfs/libxfs/xfs_ialloc.c b/fs/xfs/libxfs/xfs_ialloc.c index 2361a22035b0..c040bd6271fd 100644 --- a/fs/xfs/libxfs/xfs_ialloc.c +++ b/fs/xfs/libxfs/xfs_ialloc.c @@ -2892,6 +2892,11 @@ xfs_ialloc_setup_geometry( igeo->ialloc_align = mp->m_dalign; else igeo->ialloc_align = 0; + + if (mp->m_sb.sb_blocksize > PAGE_SIZE) + igeo->min_folio_order = mp->m_sb.sb_blocklog - PAGE_SHIFT; + else + igeo->min_folio_order = 0; } /* Compute the location of the root directory inode that is laid out by mkfs. */ diff --git a/fs/xfs/libxfs/xfs_shared.h b/fs/xfs/libxfs/xfs_shared.h index 4220d3584c1b..67ed406e7a81 100644 --- a/fs/xfs/libxfs/xfs_shared.h +++ b/fs/xfs/libxfs/xfs_shared.h @@ -188,6 +188,9 @@ struct xfs_ino_geometry { /* precomputed value for di_flags2 */ uint64_t new_diflags2; + /* minimum folio order of a page cache allocation */ + unsigned int min_folio_order; + }; #endif /* __XFS_SHARED_H__ */ diff --git a/fs/xfs/xfs_icache.c b/fs/xfs/xfs_icache.c index dba514a2c84d..a1857000e2cd 100644 --- a/fs/xfs/xfs_icache.c +++ b/fs/xfs/xfs_icache.c @@ -88,7 +88,8 @@ xfs_inode_alloc( /* VFS doesn't initialise i_mode or i_state! */ VFS_I(ip)->i_mode = 0; VFS_I(ip)->i_state = 0; - mapping_set_large_folios(VFS_I(ip)->i_mapping); + mapping_set_folio_min_order(VFS_I(ip)->i_mapping, + M_IGEO(mp)->min_folio_order); XFS_STATS_INC(mp, vn_active); ASSERT(atomic_read(&ip->i_pincount) == 0); @@ -323,7 +324,8 @@ xfs_reinit_inode( inode->i_rdev = dev; inode->i_uid = uid; inode->i_gid = gid; - mapping_set_large_folios(inode->i_mapping); + mapping_set_folio_min_order(inode->i_mapping, + M_IGEO(mp)->min_folio_order); return error; } diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c index 69af3b06be99..c7df1857195c 100644 --- a/fs/xfs/xfs_mount.c +++ b/fs/xfs/xfs_mount.c @@ -131,7 +131,6 @@ xfs_sb_validate_fsb_count( xfs_sb_t *sbp, uint64_t nblocks) { - ASSERT(PAGE_SHIFT >= sbp->sb_blocklog); ASSERT(sbp->sb_blocklog >= BBSHIFT); uint64_t mapping_count; uint64_t bytes; diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c index 5a2512d20bd0..685ce7bf7324 100644 --- a/fs/xfs/xfs_super.c +++ b/fs/xfs/xfs_super.c @@ -1625,16 +1625,10 @@ xfs_fs_fill_super( goto out_free_sb; } - /* - * Until this is fixed only page-sized or smaller data blocks work. - */ if (mp->m_sb.sb_blocksize > PAGE_SIZE) { xfs_warn(mp, - "File system with blocksize %d bytes. " - "Only pagesize (%ld) or less will currently work.", - mp->m_sb.sb_blocksize, PAGE_SIZE); - error = -ENOSYS; - goto out_free_sb; +"EXPERIMENTAL: Filesystem with Large Block Size (%d bytes) enabled.", + mp->m_sb.sb_blocksize); } /* Ensure this filesystem fits in the page cache limits */