From patchwork Mon Aug 21 18:33:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Weiner X-Patchwork-Id: 13359737 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 6F833EE49A6 for ; Mon, 21 Aug 2023 18:37:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B98788E0014; Mon, 21 Aug 2023 14:37:46 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id AD15A8E0002; Mon, 21 Aug 2023 14:37:46 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9988D8E0014; Mon, 21 Aug 2023 14:37:46 -0400 (EDT) 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 8CE088E0002 for ; Mon, 21 Aug 2023 14:37:46 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 57C2112025E for ; Mon, 21 Aug 2023 18:37:46 +0000 (UTC) X-FDA: 81148970532.06.02B9311 Received: from mail-oi1-f170.google.com (mail-oi1-f170.google.com [209.85.167.170]) by imf20.hostedemail.com (Postfix) with ESMTP id 957531C001A for ; Mon, 21 Aug 2023 18:37:44 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=cmpxchg-org.20221208.gappssmtp.com header.s=20221208 header.b=bs78ZLqF; dmarc=pass (policy=none) header.from=cmpxchg.org; spf=pass (imf20.hostedemail.com: domain of hannes@cmpxchg.org designates 209.85.167.170 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1692643064; 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=3E/b9O2HlTOi/IQwrvX2RmX6ugx51n+ANVahrlt1y9E=; b=RR3DyafEvrnGeD5B2XpeYFa3nXmVZEX/B/XPhuBMV0EK9/Z4RuzxA3l83c6pu+EeMFvN+/ QrSXv20stgIiypqcpQ/sRbxsaIKoAahuZySZG2tJhyHVTgA9/Hts8zvsiNFuBD3iICDbQT KQvy5oSF+4doT80pT2Ywt4cUh9c0we0= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=cmpxchg-org.20221208.gappssmtp.com header.s=20221208 header.b=bs78ZLqF; dmarc=pass (policy=none) header.from=cmpxchg.org; spf=pass (imf20.hostedemail.com: domain of hannes@cmpxchg.org designates 209.85.167.170 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1692643064; a=rsa-sha256; cv=none; b=cimPR6n70ckW2uUXGrXAijZAPUTqXRVF66XjJ9SSaqtYsWah3MFPxpyXDxBoCiaCY+Mo8C DQVM470Pl2zLV1+7zN30j0g7SYSaCE/BeD8rGDx9ok+N8SYxxk4A+77mVFuJk7DFO0cGqx AbwuQm4P73cSKnMFaYROS8Sz5YPZjdg= Received: by mail-oi1-f170.google.com with SMTP id 5614622812f47-3a850f07fadso1383538b6e.2 for ; Mon, 21 Aug 2023 11:37:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20221208.gappssmtp.com; s=20221208; t=1692643063; x=1693247863; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=3E/b9O2HlTOi/IQwrvX2RmX6ugx51n+ANVahrlt1y9E=; b=bs78ZLqFzdCBNP5WOZIQbmPxf0MB2IdxbI0+wTHjK3eA21DMWZU3ExKk5aSnGUtSGv VxXOxMtw21FDXY9J49x9bWd5kOiUDCL8lWn93rQTeUBXsM20t9bNh7PH/yUTZL5+Chzj r2jw52FRRe82audJSSNDAz3Dir5MIn2g0TgWAgipTEF9Pte+5X+Fm3UfzQo1qgUAV9i4 Vquc0HF8tqg2Xl3K08/Bc4G/ic+rkduZ24lP/J7PZMU1qeh2WaPyWWJMLjcOglEig1p5 mp+7h9SeFU5gRyklMRXybBl3jNbOKpbAw+pKb/mvWIH0jGBjP4LK4u0bxrbPXxhKO8aB h4KQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692643063; x=1693247863; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3E/b9O2HlTOi/IQwrvX2RmX6ugx51n+ANVahrlt1y9E=; b=MJYb/2xKUsDxf21rymiuFhWXOiBhX0wNx0Dlmlm/5dbTug3cC33xRpO6DjDEvn9O3F 3hSStvYnyeUAchP87dmdzWE3w6J4Tc23TCs0ecUWfLLPb3Sm4jttmRhriHTOgAJuQ5nL 9i14e5b18W0VEqkXS2U78DD6lQE3MtktnwGSTGlvRCCrEVLwbenEameTtwHV42TuDZr1 5D+fqX/vqK4csM1ztHOWvZesKNzZCyQWMJqlqaZJtIFWbxx0r/WbReI3D0/TmTwe2d2+ 2IOUXHBsMoM1nfLSW4z8pMFjfqk3tdkkrJzpx4PgYLxB82ZJxDOUC2ILWXg/dSP3BB9O WxTw== X-Gm-Message-State: AOJu0Ywx98qYMtu1W0egXOCL/OtrTTmAixRfqVj+dlk6IRn9V3+C8xFx NSNaa4Hrdsw4EcEQAJCwxybP6w== X-Google-Smtp-Source: AGHT+IGBSQnPB0tu7RVp53PncovhzE7SzTwHvY1Hwz+2KHc+6UHEFujdqz0TZEhwDQ+r7m42MeMWvg== X-Received: by 2002:a05:6358:90e:b0:130:df70:b9cd with SMTP id r14-20020a056358090e00b00130df70b9cdmr5101720rwi.12.1692643063580; Mon, 21 Aug 2023 11:37:43 -0700 (PDT) Received: from localhost (2603-7000-0c01-2716-699c-6fe1-d2a8-6a30.res6.spectrum.com. [2603:7000:c01:2716:699c:6fe1:d2a8:6a30]) by smtp.gmail.com with ESMTPSA id m18-20020ae9e712000000b0076d4bb714afsm2634476qka.50.2023.08.21.11.37.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Aug 2023 11:37:43 -0700 (PDT) From: Johannes Weiner To: Andrew Morton Cc: Vlastimil Babka , Mel Gorman , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/8] mm: page_alloc: use get_pfnblock_migratetype where pfn available Date: Mon, 21 Aug 2023 14:33:33 -0400 Message-ID: <20230821183733.106619-2-hannes@cmpxchg.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230821183733.106619-1-hannes@cmpxchg.org> References: <20230821183733.106619-1-hannes@cmpxchg.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: 957531C001A X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: fwg6rxjzirdgbcj8q9xh54fd1y747wbq X-HE-Tag: 1692643064-68425 X-HE-Meta: U2FsdGVkX1+fgbjoWOLy7SLR3N1DCeoCih+4PI4Hqr0BcDG3isTYMlkDUAuKxwmudqGWvwhnRxcaMpUHc5pllDZwxN2oSmHLxPY/ePmIOPtlyi7XpcRuvL1KLwiRLyGULPVTWanZIhN18+8mgvP9tW5EEk+KpdV4ZWwnq5mBst6cJKn3dPfGE2NLluJUfxcOyMHQgUy3kdGPVKG3cTe4Saya3ARD58RH9yHvmJ3FoTukmJSS0d17+7mYWFXtDMDPdP8GnLhL4ZfEtppQvw6aLuk3OMkbBS7g3eGR05/9rSwrTBneiPbge76mnPbwNR51PjbQW1qHuiiQk10v6jh8DNQ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pVBeKLUnOLJ6WzGCRBEeNU79F+VNTOH/y/U67Po2xdsZom3qL4vrJJxP6BGYg04GFQJLEcvJoKgU= 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: Save a pfn_to_page() lookup when the pfn is right there already. Signed-off-by: Johannes Weiner --- mm/page_alloc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 977bb4d5e8e1..e430ac45df7c 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -824,7 +824,7 @@ static inline void __free_one_page(struct page *page, * pageblock isolation could cause incorrect freepage or CMA * accounting or HIGHATOMIC accounting. */ - int buddy_mt = get_pageblock_migratetype(buddy); + int buddy_mt = get_pfnblock_migratetype(buddy, buddy_pfn); if (migratetype != buddy_mt && (!migratetype_is_mergeable(migratetype) || @@ -900,7 +900,7 @@ int split_free_page(struct page *free_page, goto out; } - mt = get_pageblock_migratetype(free_page); + mt = get_pfnblock_migratetype(free_page, free_page_pfn); if (likely(!is_migrate_isolate(mt))) __mod_zone_freepage_state(zone, -(1UL << order), mt);