From patchwork Sat Aug 17 09:51:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 13767119 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 9A867C52D7F for ; Sat, 17 Aug 2024 09:55:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9D7C38D00CE; Sat, 17 Aug 2024 05:55:38 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 986DA8D0066; Sat, 17 Aug 2024 05:55:38 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 875DD8D00CE; Sat, 17 Aug 2024 05:55:38 -0400 (EDT) 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 680FC8D0066 for ; Sat, 17 Aug 2024 05:55:38 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id E5E291C28FE for ; Sat, 17 Aug 2024 09:55:37 +0000 (UTC) X-FDA: 82461280314.01.F757278 Received: from szxga04-in.huawei.com (szxga04-in.huawei.com [45.249.212.190]) by imf08.hostedemail.com (Postfix) with ESMTP id 5F16F16002B for ; Sat, 17 Aug 2024 09:55:34 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf08.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.190 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1723888480; a=rsa-sha256; cv=none; b=bjLk7BBQM1/mRSVeA43ivWigdNjOL/I4GI5Cj/sBxNuBJLOIy7N44384S0ys8QbWY9B8vo 2vDJT2R/invP85tBEJRU8rlmPeQjvoCwt/sv2/xpgbqM/F+DSWdt/iu5N//dNcCvO/mATB ZAdzVG6KaRULTyJJjqCQApFXPAPmEjA= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf08.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.190 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1723888480; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hZrlL6BS+TGbWNASSVB2zXB2iQfSKIxScNHr1O896sA=; b=EeJjKZfGEDbQv/G749g+YWplwbeDNkj0t6qHsfD/U3azP7HyA3+4P1FtxeXnHPTMo8/HuW xS31tvDZnKylVqyVsh7UuvoqG4fQ6UohrfA8pn4QTdPdgZe1yPtxXxJJYXu97tuGp4TB19 7nISlNh69ys9zYQc0I+ZUYSF61bPIr8= Received: from mail.maildlp.com (unknown [172.19.88.214]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4WmDcp1zzWz2CmhW; Sat, 17 Aug 2024 17:50:34 +0800 (CST) Received: from dggpemf100008.china.huawei.com (unknown [7.185.36.138]) by mail.maildlp.com (Postfix) with ESMTPS id 1BD161A016C; Sat, 17 Aug 2024 17:55:30 +0800 (CST) Received: from localhost.localdomain (10.175.112.125) by dggpemf100008.china.huawei.com (7.185.36.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Sat, 17 Aug 2024 17:55:29 +0800 From: Kefeng Wang To: Andrew Morton CC: Matthew Wilcox , Alexander Viro , David Hildenbrand , Sidhartha Kumar , , Kefeng Wang Subject: [PATCH 2/5] pagemap: use a folio in __readahead_batch() Date: Sat, 17 Aug 2024 17:51:19 +0800 Message-ID: <20240817095122.2460977-3-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20240817095122.2460977-1-wangkefeng.wang@huawei.com> References: <20240817095122.2460977-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggpemf100008.china.huawei.com (7.185.36.138) X-Rspamd-Queue-Id: 5F16F16002B X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: r8c6w8ym7fcth8ikzq39j9741yuzqw33 X-HE-Tag: 1723888534-754274 X-HE-Meta: U2FsdGVkX1+WJBm9+IszCT0eBgE61FdJcO3EEpsDcWGZPIpJjY9/5xDvTtLk6pTTYUKmlBni3DmB2V+Cs6CceC1ttI8TcMICngHGLK8wMGvIiB4veJCR8cFF1p+1M9T5hgIh0SVjyTVNJb597G1XqwMfICpifx+SktxKOc80e+BXMEXU4Hgg9yAraP3Uul93VjzJD01A5dKnLVxn68mwo0lvlQ+6W6pogrrs+zFvwKl/pfb61e2Qw0obzlm8Td0j42glkVgoR0TDJXBI27SFykUceZZQtkCSv0InMjBQb5xDyRL6ojzSUphU716Tovzx5Rx/pAdU9/Sczc4SK78ome8zrsTUxnp5j6Ey0BUGAc9k1rHaB6WCRPkCewRSUV45UcLFH/3165q0/ytEuh5NzDkbFPw0TvvCdCPrYQFbkbF23sDiF3kWBjH7zohQ/02vWntpj56u3HquGPACZ8vUHdwpP3UHCSdolKx6053hJkrTr2dOTlfB693oum7YxZ+MathRoQKlHZIYOHF0M+qIlfHRgAOgQ520BpZ4tK+wcXsjU3gng54PXcN4j40sOlEDkkyRZirh8CdoOkMvgRiNNylNs6oq0ve6s8kXdDYp2DkZap70fWZRNAJbsuMj6+I0Y7ntS9o942Qw5zemshoRF8aAikd2hIcVeI6ilMkJlkmONkFfH7Bo4tHq+zxFx3e6blZhp9HKpm0JsD9GOcyDp2eYAIoGqVkafqmqOcKSQm/laVxxF1HVrwO8TLbXwHIe7nC3WXSnJQy0s7IotZaOOu94SkSDomLw0I2SQOKBt9NoIdYynd3bpKuPQmzY4hs6Tghh96w6+3vamd8jcE7Oz+5DB1bpvxKOGetfQotqhXPo/rWdUhKgplVKFKvkfezOtdeyo3c0HC75ATJK18g7BHz67J8SZ4I0bKqN1/wWUdJPYzNixovhV1e5b/eT1VuaA71+9ytyY123EX30apk K2WRBAS7 Ci3o+BLuMXo6yqIZVr1CxfFmgPEJLTH4Xd8hTjnZ+8Fg6QLAV83RoC4bkzWpBa3mR8iQgeS8KrGJRARP/QlsoKqBRYFVhAOk8Juht/Dp3C2ghSDuDh00qGbyCGOR76EYmw/r7Ur9CCQ0jYkeQ3G8O3cR70gEGa6+o7hLqdfs6aPR0K+2BjamKrlKP4RlFMK62Lags 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: Convert to use a folio in __readahead_batch(), remove the check of PageTail and thp_nr_pages(). Signed-off-by: Kefeng Wang --- 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 68f59cd7637d..a83913555497 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h @@ -1363,7 +1363,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; @@ -1372,13 +1372,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; + rac->_batch_count += folio_nr_pages(folio); if (i == array_sz) break; }