From patchwork Wed Oct 2 15:25:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13819961 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 D3495CF6D38 for ; Wed, 2 Oct 2024 15:25:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E96654401AF; Wed, 2 Oct 2024 11:25:43 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D5E464401B5; Wed, 2 Oct 2024 11:25:43 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 913F14401AF; Wed, 2 Oct 2024 11:25:43 -0400 (EDT) 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 11C0A4401B3 for ; Wed, 2 Oct 2024 11:25:43 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id DA6D840969 for ; Wed, 2 Oct 2024 15:25:41 +0000 (UTC) X-FDA: 82629036882.27.8CFACBA Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf27.hostedemail.com (Postfix) with ESMTP id 3D0EA4000F for ; Wed, 2 Oct 2024 15:25:40 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=PEmz7+tG; dmarc=none; spf=none (imf27.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1727882700; a=rsa-sha256; cv=none; b=j3kUmtOS+VJjG1PBJFgnnIIWjJ/+wzJh7sQdS7hHFecbjj/Bs8mybbA+gHkD5NcDPmsgiw E2fTO8umCxUWs7Qw9pGGtlmNXb/qeKxZnL/GYyhyoOZXJhUdk0VvxcXK499AUFM0hPkQ1r SjFTSTer8xJ14A2WhPX18dJbhzQUn10= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=PEmz7+tG; dmarc=none; spf=none (imf27.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1727882700; 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=BHSkQbfE9OSS4Gcc+cusQ1yIKFnsRdiSuAk0K9hJPNM=; b=z4I7nDsViM/euhkXbPKDpH+1GEu01IfyVoaCb34EDK92DAAdaUsLwOkQTErxLpFyBc38Nu MJN1vsHcWY1QxMN1dNhX54TjYBnZO/I3TlU/rPA9KGJEvPSeE/aIT08L4VOoisSXpJtYZ/ xHA97nCpjQXZEZZfPLQ1pNxFJzWQa6o= 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=BHSkQbfE9OSS4Gcc+cusQ1yIKFnsRdiSuAk0K9hJPNM=; b=PEmz7+tGyOvS7K6HZw6CAD15Wn UtSEuyqry0lHJ8R4Jsu/cAm08l5hVrOH4jwm9xW/PxnVeoVvf/syUgtalzf9PJ02j3HOZqFuN3tR+ ZiOrASzyzQ2giabq0VQ/eq7A1r85DEMc7zCttYOK82BxO1Jv79Sj1L+CGxeA7AGFs+QK2V5pTIsDd xvZaG3C0Ege/iwVAeonpPDRx+MytsSVgjj1D0i96+jcgKFoZyhI2hc2VJDWbo6keJ+OFSFJGvGh6r jaBdwvyl/TJsPIK9XTzj/bbH8rdVgrSQm0urBp1U/kKl/82ZNB90Ut7q4u1TaIdidkBBTHN39VwZq a2/YQ9dg==; Received: from willy by casper.infradead.org with local (Exim 4.98 #2 (Red Hat Linux)) id 1sw1EN-00000005fMq-1Ru9; Wed, 02 Oct 2024 15:25:35 +0000 From: "Matthew Wilcox (Oracle)" To: Andrew Morton Cc: "Matthew Wilcox (Oracle)" , linux-mm@kvack.org, Alex Shi Subject: [PATCH 3/5] ksm: Convert should_skip_rmap_item() to take a folio Date: Wed, 2 Oct 2024 16:25:29 +0100 Message-ID: <20241002152533.1350629-4-willy@infradead.org> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20241002152533.1350629-1-willy@infradead.org> References: <20241002152533.1350629-1-willy@infradead.org> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Queue-Id: 3D0EA4000F X-Rspamd-Server: rspam01 X-Stat-Signature: a866qbfu14fg1pj547c8sp33jh84kp6b X-HE-Tag: 1727882740-128226 X-HE-Meta: U2FsdGVkX18kSBtT/k9sA0oPoKHq1I0ZJDqCkaJZjaSrtZB4gM+NPPQWK2qVpSSsZWNDTHqfy0OCTEqeSU5mCNfdgZwNc5OnImVhO7CdH4b3KrZXc+XJENtfqfZGWNuc2cMqKV/skE8Gm83pFAr8A1HbWnoZGFDNHsttsp0xBtn7f68vmgsyZIw7ukhwehdQVroM/xoJZrPICsC41CZnMw0gMxbecNvJGF6wpMVRapgazRo1m0CBlx1e5Onog9ruDGtQplnhmcLgMwUIszl+i3TnP0R+muu0Dsy8rARk4I6bNKn3Zvk+SxdTe6M1LIchfkQIpshcs7HRVPEJFtTbTixRFlyaGYL1G5AEY4kIuCVd44BYcFkesYB5uVvIWF08Gx2q2FAqofet/zQJYkQbsY057JWiXeUrjXAzEa0H236cQTAIc7fE8xruZf17FloX8nWLiq3PtO7a5600ukrV00xkQ+IcgIpbanT2NmjrQxiYBj+vgtBM7a1Z4cKxxVVLkqqBLIn2msvxqL1VvQKBVrhpYCCaKnZHK7KOwdTFjt95959I5Dq5ij1S3YFuCNPBhRf6uimIDxwBzindUx3rxlvGbs/DUH/p6t90Tsa2uJCDgvEVjrWSF8tsJKqgmjAIreVz2jZApDgp6f2GfVv84Eqa4ddhuZmCZd/LzkfVr9BrHX11Ylg4Loxc7pQfHhYoO7Z2euTqclU1L+LONlRTvqAiopVy9tP2IA/LtdRtz5QdERD0IsQ5KICZMZ7rcRORUcFhHFUuU69gkYVNs9cQpreAX2doIs09ElZtbATf41IpoYGb9xR4g4+RmYeat8yaZz+buWYcP6ne7rNb8RWHL96YecShCa/c7eafZ4K2a7ekBYge3HGFV76MX5SSyqIpufn9K49iSvvvaZSHIqmAdTWdzwSjMAzhvKV0g7vxMh6b5rPeILqgZlr4P2hDfSFW2I/DbrudnuKAphGR2fE 93QjhHzN wVnydjM99SaslYu3yb0FtjFdP7eSPWoUTb0fOMtkD9qQ/t073BFhFqVlKQmVQ0kW4yHp0+dPJC3+YkuPf3RH4PkvKl3xR+b+H0JsxXsjvcHMVmfdT4OGxmEKXoeeNXzQQ52Zs7PZcJVzw8Pl5a8BKaSfntULcR5bs8Iq/h+g5GaruQBw8ni5ValTRpyFxi2ZnUn7df3scSi0c/JCu3/Zzsv6VymnsOvlWLTWXQp+XDJLtgN2djq53vJYzMVaItIFJu8wD8YPim8rkd7Bc7WQnLH+x8oiDWNYFf53+ 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: Remove a call to PageKSM() by passing the folio containing tmp_page to should_skip_rmap_item. Removes a hidden call to compound_head(). Signed-off-by: Matthew Wilcox (Oracle) Acked-by: David Hildenbrand --- mm/ksm.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mm/ksm.c b/mm/ksm.c index 19e17b228ae1..1b8b43dc6ba7 100644 --- a/mm/ksm.c +++ b/mm/ksm.c @@ -2402,10 +2402,10 @@ static unsigned int skip_age(rmap_age_t age) /* * Determines if a page should be skipped for the current scan. * - * @page: page to check + * @folio: folio containing the page to check * @rmap_item: associated rmap_item of page */ -static bool should_skip_rmap_item(struct page *page, +static bool should_skip_rmap_item(struct folio *folio, struct ksm_rmap_item *rmap_item) { rmap_age_t age; @@ -2418,7 +2418,7 @@ static bool should_skip_rmap_item(struct page *page, * will essentially ignore them, but we still have to process them * properly. */ - if (PageKsm(page)) + if (folio_test_ksm(folio)) return false; age = rmap_item->age; @@ -2561,7 +2561,7 @@ static struct ksm_rmap_item *scan_get_next_rmap_item(struct page **page) ksm_scan.rmap_list = &rmap_item->rmap_list; - if (should_skip_rmap_item(tmp_page, rmap_item)) { + if (should_skip_rmap_item(folio, rmap_item)) { folio_put(folio); goto next_page; }