From patchwork Mon Mar 3 17:53:11 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13999331 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E92B82153C4 for ; Mon, 3 Mar 2025 17:58:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741024702; cv=none; b=lixyilr+TcJ97jJtVPBSJT2yIjbqhxRGoGbXFtnSAXrVK02SNj+brQO1ib7rNd8B81n8v/pK3lAEqBjbfN6Q+WEopUKFX2xnkblzOjvdo/fb7RJfFsuzGd1RLdtaGM/UI4jG5m3RR7Ywm0E1nmIO8tWlB6go2M2zi/IRxyacfeA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741024702; c=relaxed/simple; bh=NoqP4mZ/ulC73L6aQP6VwJZDLqV+gHGVcMEKjG+Z7RU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=lIauRVp2GZPq62AW132DmKZzRx/zvYc/AfEe/R8Zf+TPbB5zmPB43lfwXCKps5SjI+flTbuxV+dlUqFDWM7I168oXskGhyyhsiIZMrnYM18JV4HiM4/sjBgJSPQ4AvSoLuaIg9Hw23hgluQP5leDO4l47S1nQj2ZZz1gTstU1JM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=MN/zpEt8; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="MN/zpEt8" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=oH16NlP8xxrt4wivtUXbkuoeB6TY0U2c9UggzJlO6Zg=; b=MN/zpEt80N0N2X5802zEZW1Gzc PSjSmw+iD24oea5D/lUoixIMhX9FS9A25h0R6T5x84JqkY/qyjiI7fKCc8jdDoZz8bp6HcP7UyAMk XIE/yCy4eXRICMs96FZZxnzRGWxRlG/3J+GX9VoIfOcl48LAi9XuqVMNYec07cZ4XjXCS5QgMdMC9 feuDrqtpQhtHf/tFw+ZWMS36RARhb1g/ITtw3M+oRWf+K3F5uGXg0K5vWl8SR01bfEwp0Puq6zK38 uRqmXA0DYDuAzSqwnaS5oFXFiHk2OlgMhXk9bRCPyQ06yGYq5UxCUlknVropgc/MF7VigJ3Mg9Txm JLpoKnmA==; Received: from willy by casper.infradead.org with local (Exim 4.98 #2 (Red Hat Linux)) id 1tp9zg-0000000DlCl-0Xql; Mon, 03 Mar 2025 17:54:35 +0000 From: "Matthew Wilcox (Oracle)" To: David Howells Cc: "Matthew Wilcox (Oracle)" , linux-mm@kvack.org, linux-fsdevel@vger.kernel.org Subject: [PATCH 1/6] iov_iter: Convert iter_xarray_populate_pages() to use folios Date: Mon, 3 Mar 2025 17:53:11 +0000 Message-ID: <20250303175317.3277891-2-willy@infradead.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250303175317.3277891-1-willy@infradead.org> References: <20250303175317.3277891-1-willy@infradead.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 ITER_XARRAY is exclusively used with xarrays that contain folios, not pages, so extract folio pointers from it, not page pointers. Removes a hidden call to compound_head() and a use of find_subpage(). Signed-off-by: Matthew Wilcox (Oracle) --- lib/iov_iter.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/iov_iter.c b/lib/iov_iter.c index 65f550cb5081..92642f517999 100644 --- a/lib/iov_iter.c +++ b/lib/iov_iter.c @@ -1059,22 +1059,22 @@ static ssize_t iter_xarray_populate_pages(struct page **pages, struct xarray *xa pgoff_t index, unsigned int nr_pages) { XA_STATE(xas, xa, index); - struct page *page; + struct folio *folio; unsigned int ret = 0; rcu_read_lock(); - for (page = xas_load(&xas); page; page = xas_next(&xas)) { - if (xas_retry(&xas, page)) + for (folio = xas_load(&xas); folio; folio = xas_next(&xas)) { + if (xas_retry(&xas, folio)) continue; - /* Has the page moved or been split? */ - if (unlikely(page != xas_reload(&xas))) { + /* Has the folio moved or been split? */ + if (unlikely(folio != xas_reload(&xas))) { xas_reset(&xas); continue; } - pages[ret] = find_subpage(page, xas.xa_index); - get_page(pages[ret]); + pages[ret] = folio_file_page(folio, xas.xa_index); + folio_get(folio); if (++ret == nr_pages) break; } From patchwork Mon Mar 3 17:53:12 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13999332 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 75A9E21B9CF for ; Mon, 3 Mar 2025 18:00:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741024812; cv=none; b=ijLBz5MheZbANxqN0czgem+wJLeBxBMQCDmU0+onkt/ToPENSbWogSRbsHdrk2lk/De3XZled0qRUtOofHXSOK9wy8LoV0SleGZLDG1ZMk7ZoDSrA5ASHZZ1XCaSs+nORRhB2BHwLiKHE27KkHIu/c+ij29CoWr5aWzBMK+peVU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741024812; c=relaxed/simple; bh=ppWqVpLWY1FoF2mV9uTvYTME8yEGySTdGXXclKMhMOg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=lnZDFFI+Q0ypfyMj0KC15y1ulV2VWS6HxbZdappuKOEpqaMW2B1mizc6nF4np6uvbvKOApixYYuS3RPsBdT1MW4/Mvp4jiLRz9fwCYjPdmEdsu2d9OEVTeCl2LPrWtAn2nMwfG8Nh6x5AJWG1be9ZNwqe/ByPrxqkMBmNjQlQJI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=WI4+Su5w; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="WI4+Su5w" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=ac55yYGUrmgmfjDkZd7lZLD1cRecm/nrYCkJ9H/XhoA=; b=WI4+Su5wNeZh6dg7wStk7EFkqj sVln2SyYzf3X9frXhnAGuaK37AeqGdQrklihxMtovIrrzuAaPjGH218lObXI50mw0+WAdneVO/ijD ioTMwR8e7r7n0JiIRsR9gVA3TfZJ1Q9DsawKaE0G2pEHdkD4k0u85oDFhLM8Zy7awvITp9rPetKl5 NymWaqf7b5RNdPhqSm9w61VMBqg2+Ty3gOxunACx0ACwNb9tpxP4OaDK6RBk0asjaN2WpyWQwSQ3W PW8N5sLByxgueb5/70Lmrf9Oc2x01DVxA7TpyFUU5qAUD46/AodcgzjzxdHjJ4rpKQNBfOEVc1Iw8 iEeRRbgQ==; Received: from willy by casper.infradead.org with local (Exim 4.98 #2 (Red Hat Linux)) id 1tpA20-0000000DnEk-1nep; Mon, 03 Mar 2025 17:56:49 +0000 From: "Matthew Wilcox (Oracle)" To: David Howells Cc: "Matthew Wilcox (Oracle)" , linux-mm@kvack.org, linux-fsdevel@vger.kernel.org Subject: [PATCH 2/6] iov_iter: Convert iov_iter_extract_xarray_pages() to use folios Date: Mon, 3 Mar 2025 17:53:12 +0000 Message-ID: <20250303175317.3277891-3-willy@infradead.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250303175317.3277891-1-willy@infradead.org> References: <20250303175317.3277891-1-willy@infradead.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 ITER_XARRAY is exclusively used with xarrays that contain folios, not pages, so extract folio pointers from it, not page pointers. Removes a use of find_subpage(). Signed-off-by: Matthew Wilcox (Oracle) --- lib/iov_iter.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/iov_iter.c b/lib/iov_iter.c index 92642f517999..c85ae372bc05 100644 --- a/lib/iov_iter.c +++ b/lib/iov_iter.c @@ -1646,11 +1646,11 @@ static ssize_t iov_iter_extract_xarray_pages(struct iov_iter *i, iov_iter_extraction_t extraction_flags, size_t *offset0) { - struct page *page, **p; + struct page **p; + struct folio *folio; unsigned int nr = 0, offset; loff_t pos = i->xarray_start + i->iov_offset; - pgoff_t index = pos >> PAGE_SHIFT; - XA_STATE(xas, i->xarray, index); + XA_STATE(xas, i->xarray, pos >> PAGE_SHIFT); offset = pos & ~PAGE_MASK; *offset0 = offset; @@ -1661,17 +1661,17 @@ static ssize_t iov_iter_extract_xarray_pages(struct iov_iter *i, p = *pages; rcu_read_lock(); - for (page = xas_load(&xas); page; page = xas_next(&xas)) { - if (xas_retry(&xas, page)) + for (folio = xas_load(&xas); folio; folio = xas_next(&xas)) { + if (xas_retry(&xas, folio)) continue; - /* Has the page moved or been split? */ - if (unlikely(page != xas_reload(&xas))) { + /* Has the folio moved or been split? */ + if (unlikely(folio != xas_reload(&xas))) { xas_reset(&xas); continue; } - p[nr++] = find_subpage(page, xas.xa_index); + p[nr++] = folio_file_page(folio, xas.xa_index); if (nr == maxpages) break; } From patchwork Mon Mar 3 17:53:13 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13999339 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EB0C72153C4 for ; Mon, 3 Mar 2025 18:01:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741024870; cv=none; b=sjsroW4rMIhCAJ/vqqZRX8ku0GlEB6ZxC9Dv4mwrWr80mMWeejmxsvX1NDbSV+tRtMaN8BajyOVDk082PV44aM44rqlYL1ou1ns+N/+tNla/Izu1zbvbxfGSQifEx0XWCrBpwWtCl9tAPcXikkxwKMzbNtB4GnPSd25xsTsIbl8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741024870; c=relaxed/simple; bh=N+f7VhgLvEt1EOwjm0WQnntkrOyK2xWskl47TmAl+wU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=SMXj00Om4bFKz4nsx5+Uju8opRCEjFLSx0oljjAYnEOPIJcjeEyDj9K4FpiMzBqH/Cp9c7Ae85tFJ6kFJ6XwjnjJuAPMhqU4UwOFCb4PMOFlaJRQVenXqAcOIZU/3EtkS8M6XO5Rl8XF9JCtVx08/Vw3QKBHElTIEPYGY1+tpd4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=YgwKMYWd; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="YgwKMYWd" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=4Fso8EI/ac8noZP5COjS8e1jpZSdYEWCWF69/ISSz5w=; b=YgwKMYWdVA6BXZ0zMwzEmFFQ5L bWYLvSkcg6+F0gfp9f94CTLp7+znhPYmWCXrVR6anLxEJisRZtad8sbHkKBeu9vJHmI+B84lZJbg6 og15e7PyL7AmgxL7jdV1fz9jWBcGSkDxUciKsrI5dBC79Eyc0zWAjzm9mnbFMzBB0TgiDER6FPniM tVtq73LP01vEW9VTQlMtABHCk5XhezymXUaz1msmzOabtvZhA0lZ41jr05dbHOADtO/WfyMvXnrdF R8e/o0005bXw1XQ/UHrygEgM+g3bl79+PJXR8NKAd1K6PkATw1RDEDdp1+5sQVHQbl9iEm7PJKzqA EjECnNtA==; Received: from willy by casper.infradead.org with local (Exim 4.98 #2 (Red Hat Linux)) id 1tpA4G-0000000Dp9Y-1iRM; Mon, 03 Mar 2025 17:59:26 +0000 From: "Matthew Wilcox (Oracle)" To: David Howells Cc: "Matthew Wilcox (Oracle)" , linux-mm@kvack.org, linux-fsdevel@vger.kernel.org Subject: [PATCH 3/6] pagemap: Remove find_subpage() Date: Mon, 3 Mar 2025 17:53:13 +0000 Message-ID: <20250303175317.3277891-4-willy@infradead.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250303175317.3277891-1-willy@infradead.org> References: <20250303175317.3277891-1-willy@infradead.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 All users of this function now call folio_file_page() instead. Delete it. Signed-off-by: Matthew Wilcox (Oracle) --- include/linux/pagemap.h | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index 798e2e39c6e2..e51c0febd036 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h @@ -945,19 +945,6 @@ static inline bool folio_contains(struct folio *folio, pgoff_t index) return index - folio_index(folio) < folio_nr_pages(folio); } -/* - * Given the page we found in the page cache, return the page corresponding - * to this index in the file - */ -static inline struct page *find_subpage(struct page *head, pgoff_t index) -{ - /* HugeTLBfs wants the head page regardless */ - if (PageHuge(head)) - return head; - - return head + (index & (thp_nr_pages(head) - 1)); -} - unsigned filemap_get_folios(struct address_space *mapping, pgoff_t *start, pgoff_t end, struct folio_batch *fbatch); unsigned filemap_get_folios_contig(struct address_space *mapping, From patchwork Mon Mar 3 17:53:14 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13999340 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E31C71F2B88 for ; Mon, 3 Mar 2025 18:01:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741024879; cv=none; b=PWoY5G+d/te7itP+th7hCKK+pKhLHNjIH6XFm2J5I0sWBEaG7N814lR813PV+wL5wvchisqiOdR+8G5Lz9Z8eqVzp7sAzrq90ddtueouIEQfWkAgIqZZgP6s/jSV333khrNUftOGwvCKIiFULmY6e8JFtvD2ia7QGexyJdO+7/M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741024879; c=relaxed/simple; bh=2IpxagfiodeLlTSlditW/GRWScnS46KJFRnJ/rC30XU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=n4Qqmyt029Mua7FY9X59371w1l37oigi8q53EvrSdU/JATBVv0u6YInBqw99ijNJdyIJcvCShnLF4Ug4uocsJKaQedgg5rZU3J4/oxw2FmXS9qzMd6oPGLT+lGdm7bZCtjUQx5LOpQhYissW/sWjAzBm0wmNuZpPjQgtx6T2AKM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=C2Gcgd8a; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="C2Gcgd8a" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=mhPMBfMr6QjIX4xpzAErSRJyHiDJ/wVChcGhzQucYw8=; b=C2Gcgd8agHSIQ1790V1Wv10iNk 4Ix+WsA8iv+U8YNxjILMKfqqOpMjasBQQDlplBeOayYQlCVjOduBqcYvyf0iZDSO0hElsSEs2Y6zA 3U6q2lZ9jbLmVjmIopms7q5ht3dFZMmQrEzMDcSIiyswDBkSwoEQeqdGYuNIGhwRpwdeAGRdqERpd LTuIAlY3A/ub8VCtHLr+OvtfWyOY1S/exosr7ekFfwjs5uj1vXje+0JgH3Nm25o+Vg5jXW0os+GC/ 7u7phC+CbUpFD6CUhHcuH06UcjRtph9PXh5dmDLAUtZC3TuSJntxM0NL1b5v3B7ZlxDbP8EiPHA4Z oVuRXbDQ==; Received: from willy by casper.infradead.org with local (Exim 4.98 #2 (Red Hat Linux)) id 1tpA64-0000000DqU4-2rOs; Mon, 03 Mar 2025 18:01:02 +0000 From: "Matthew Wilcox (Oracle)" To: David Howells Cc: "Matthew Wilcox (Oracle)" , linux-mm@kvack.org, linux-fsdevel@vger.kernel.org Subject: [PATCH 4/6] filemap: Convert __readahead_batch() to use a folio Date: Mon, 3 Mar 2025 17:53:14 +0000 Message-ID: <20250303175317.3277891-5-willy@infradead.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250303175317.3277891-1-willy@infradead.org> References: <20250303175317.3277891-1-willy@infradead.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Extract folios from i_mapping, not pages. Removes a hidden call to compound_head(), a use of thp_nr_pages() and an unnecessary assertion that we didn't find a tail page in the page cache. Signed-off-by: Matthew Wilcox (Oracle) --- include/linux/pagemap.h | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index e51c0febd036..f4b875b561e5 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h @@ -1449,7 +1449,7 @@ static inline unsigned int __readahead_batch(struct readahead_control *rac, { unsigned int i = 0; XA_STATE(xas, &rac->mapping->i_pages, 0); - struct page *page; + struct folio *folio; BUG_ON(rac->_batch_count > rac->_nr_pages); rac->_nr_pages -= rac->_batch_count; @@ -1458,13 +1458,12 @@ static inline unsigned int __readahead_batch(struct readahead_control *rac, xas_set(&xas, rac->_index); rcu_read_lock(); - xas_for_each(&xas, page, rac->_index + rac->_nr_pages - 1) { - if (xas_retry(&xas, page)) + xas_for_each(&xas, folio, rac->_index + rac->_nr_pages - 1) { + if (xas_retry(&xas, folio)) continue; - VM_BUG_ON_PAGE(!PageLocked(page), page); - VM_BUG_ON_PAGE(PageTail(page), page); - array[i++] = page; - rac->_batch_count += thp_nr_pages(page); + VM_BUG_ON_FOLIO(!folio_test_locked(folio), folio); + array[i++] = folio_page(folio, 0); + rac->_batch_count += folio_nr_pages(folio); if (i == array_sz) break; } From patchwork Mon Mar 3 17:53:15 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13999341 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9B8BD1F2B88 for ; Mon, 3 Mar 2025 18:01:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741024882; cv=none; b=bdxAQkLu58P8jvx35bRWL/9YDCtJBgQksg5BmjmRHNPICRFYF5Ei8w+2cznOtrsfgf7xL4y/U9T2FFs4T4aPk969Tbrn77nV/wK3p0qfi4I768622m0r9JmstN8+jvFUrnJaBu9IFR2HsQ/WH8BEl5DXNjl57bnBeW/1O3xP6sQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741024882; c=relaxed/simple; bh=lA8N5oit7EGNRH5aGIVw8AazWSQAhu3XE0YioIePRIw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=W20mj7a02JEijUNUijRVE9flJI2XwK+Yb9gZUBfLfFdX503/tesk4N7yV84yppbbQgTvjl96IyBTLxIUlYDktiONwZd94TDGJmGbzFsY8/om3fhyBxPZeAHczmGgcUWItxdwkq8oHKthHdChS6uGZmvSVXkcX8ZYDf5RrJas9+o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=EC642/Q+; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="EC642/Q+" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=NPQLhzTyEMzPLgCXVEdgocc34iqkc/85plAdXTJVcFA=; b=EC642/Q+e1n8Jte66sDcf2YMpk ik8RpSlGYjW30isIt1q9YXZgZK4A707jQZLUxBboa0n6M4VbZAlqa7ir9f6p1Z0O2GKux1uqtGS6V tkjojKOWm/hOmI5B6UdsrLdeLLX03J9W74sQCd+WxdJHXGNI7QOvmhFWLaUdfU59UXMkj7LY8ebHG OtsfLp79FfZN2RkOR/dkh7+JZAoDqzwXcePI8uNmnv1HaYcZ0yy4Cord9IV4yq2NK5P9iob8CVa7X DTgQ+BEVXZ55F7RWsiT/Le4rccCBbS7zoVCoPyKrSafs9RCuxYxDpSUmxcWTpFfofe9wpO7DEq/Zl 9fkBYBkg==; Received: from willy by casper.infradead.org with local (Exim 4.98 #2 (Red Hat Linux)) id 1tpA6G-0000000Dqcg-2VVL; Mon, 03 Mar 2025 18:01:10 +0000 From: "Matthew Wilcox (Oracle)" To: David Howells Cc: "Matthew Wilcox (Oracle)" , linux-mm@kvack.org, linux-fsdevel@vger.kernel.org Subject: [PATCH 5/6] pagemap: Remove readahead_page_batch() Date: Mon, 3 Mar 2025 17:53:15 +0000 Message-ID: <20250303175317.3277891-6-willy@infradead.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250303175317.3277891-1-willy@infradead.org> References: <20250303175317.3277891-1-willy@infradead.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This function has no more callers; delete it. Signed-off-by: Matthew Wilcox (Oracle) --- include/linux/pagemap.h | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index f4b875b561e5..4a1c9dc92d82 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h @@ -1472,20 +1472,6 @@ static inline unsigned int __readahead_batch(struct readahead_control *rac, return i; } -/** - * readahead_page_batch - Get a batch of pages to read. - * @rac: The current readahead request. - * @array: An array of pointers to struct page. - * - * Context: The pages are locked and have an elevated refcount. The caller - * should decreases the refcount once the page has been submitted for I/O - * and unlock the page once all I/O to that page has completed. - * Return: The number of pages placed in the array. 0 indicates the request - * is complete. - */ -#define readahead_page_batch(rac, array) \ - __readahead_batch(rac, array, ARRAY_SIZE(array)) - /** * readahead_pos - The byte offset into the file of this readahead request. * @rac: The readahead request. From patchwork Mon Mar 3 17:53:16 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13999342 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 424A3216395 for ; Mon, 3 Mar 2025 18:01:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741024894; cv=none; b=nuYA8q0aYOF3zjaShiaVyVogu+KCJQohzGBOTboenHckT/pnPu1wctLNR/kzOVARDjc4dOdcEMgelNISybwwoaxn21oE6jXs8NKThcIi2QwKYNyldv0aV0dEPOUwN4losE6F03dZrWOVJ6fOw8SKsIWiDcaEEjL75SDrzyB1Q/c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741024894; c=relaxed/simple; bh=ltd+CzroaAgVHUZwP56MGRkdxKI2UpUX7WD0wrPjEsk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=p7wCsKvSgb8jThU35Poky/XysKYU9zWAKc8J3YV24FpVWWwdt2oS3Op4tdi+Fx5AUUqEpY+e7xOX46Do+6p9BH3koPOAJfXeHUJj6x7E1RY02mHTu5b4DgRIaqSPSu0t4cXmtmjzIsswDAkfMpbMZMls6sQXyWsxmeN9ZmSDW/M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=vFudsMSq; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="vFudsMSq" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=RcgDT1xygmH/LT/R5zLj021l+cmpyVBR/9bFD0Q5VpM=; b=vFudsMSqkBn0xDDBiohbJEXHLa QLa7rHLnHAHYbpGTgBHCdeLaPxR/eDwkZ9Ogx8VBR6L5XhLgy+lJNRMNSca75E710QSEbHUOoNo1M L76wf7Jq9JAkMW/BsypioJ8w34UKNJyybD/t+CBF7TLwnFVUNaz96fEJQWnsaG+po5ISvbAvxc4iU JcmcWMhhFoStOofzLSG+0JY492ZJt5un3fqPpi16J3scE+Sm8eBrk6riOtX1CLMEIus+QkBd6sEIb Sl4ikXfWkJxHzG4hlFdcWc/5wgjBhQezQMrW5xk/ccwDsgPgRlM2KqdndnyrSmYcLgcVY5WSDE1pZ 47MKkj2g==; Received: from willy by casper.infradead.org with local (Exim 4.98 #2 (Red Hat Linux)) id 1tpA6P-0000000DqhH-09Od; Mon, 03 Mar 2025 18:01:17 +0000 From: "Matthew Wilcox (Oracle)" To: David Howells Cc: "Matthew Wilcox (Oracle)" , linux-mm@kvack.org, linux-fsdevel@vger.kernel.org Subject: [PATCH 6/6] mm: Delete thp_nr_pages() Date: Mon, 3 Mar 2025 17:53:16 +0000 Message-ID: <20250303175317.3277891-7-willy@infradead.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250303175317.3277891-1-willy@infradead.org> References: <20250303175317.3277891-1-willy@infradead.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 All callers now use folio_nr_pages(). Delete this wrapper. Signed-off-by: Matthew Wilcox (Oracle) --- include/linux/mm.h | 9 --------- 1 file changed, 9 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index d5844ade822c..39eef633d725 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2129,15 +2129,6 @@ static inline unsigned long compound_nr(struct page *page) #endif } -/** - * thp_nr_pages - The number of regular pages in this huge page. - * @page: The head page of a huge page. - */ -static inline int thp_nr_pages(struct page *page) -{ - return folio_nr_pages((struct folio *)page); -} - /** * folio_next - Move to the next physical folio. * @folio: The folio we're currently operating on.