From patchwork Wed Nov 23 13:40:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: wonder_rock@126.com X-Patchwork-Id: 13053663 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 6C9ABC4332F for ; Wed, 23 Nov 2022 13:41:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 042156B0072; Wed, 23 Nov 2022 08:41:01 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id F35996B0073; Wed, 23 Nov 2022 08:41:00 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E23796B0074; Wed, 23 Nov 2022 08:41:00 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id D2D9E6B0072 for ; Wed, 23 Nov 2022 08:41:00 -0500 (EST) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 84164ABAF0 for ; Wed, 23 Nov 2022 13:41:00 +0000 (UTC) X-FDA: 80164817880.27.07F2134 Received: from m126.mail.126.com (m126.mail.126.com [123.126.96.242]) by imf01.hostedemail.com (Postfix) with ESMTP id 396EC40005 for ; Wed, 23 Nov 2022 13:40:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=126.com; s=s110527; h=From:Subject:Date:Message-Id:MIME-Version; bh=x8W5f h9VbHoZWZ6ymIAUg8ezurxWq9/jC6mUoLoDw1Q=; b=MYXMqZXeTIN/UKn+cnY7R AtqJQvqhloF4QjKVbTHXCt8qSfGIDZ9DLvX6BrZ651SLJJuKxjvV1rFB/2gis/af 9bVQDWnrTmUKwVVUufy9twX5G9gdgA7fuV7+MPv9YkKvvBpB9TP1WuMlgBaS2a8A O9GvVBW6sO/rSkGXtZvR+E= Received: from localhost.localdomain (unknown [221.228.128.183]) by smtp12 (Coremail) with SMTP id fORpCgAnN0TjIn5jjy+BAA--.33586S2; Wed, 23 Nov 2022 21:40:53 +0800 (CST) From: wonder_rock@126.com To: akpm@linux-foundation.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Deyan Wang Subject: [PATCH 1/1] mm/page_alloc: merge two get_pfnblock_migratetype() into one Date: Wed, 23 Nov 2022 21:40:43 +0800 Message-Id: <20221123134043.33896-1-wonder_rock@126.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-CM-TRANSID: fORpCgAnN0TjIn5jjy+BAA--.33586S2 X-Coremail-Antispam: 1Uf129KBjvdXoW7Wr17tFWrAr1rKFyfGF1fCrg_yoWDZFg_ua nFvrs7Cr43tF9F9r47Awn7JF97t3Z5CFyxWa1rJrsxAFWUXFn7tF4DJrs3CrZ8WFsIgry8 C3WvvFZIkw1IqjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7sRtZ2a7UUUUU== X-Originating-IP: [221.228.128.183] X-CM-SenderInfo: xzrqvv5ubu0ubn6rjloofrz/1tbiuQXCgVpD-MRFVAAAsP ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1669210858; a=rsa-sha256; cv=none; b=5BSHsGGp0sm5SKQGa1iAVdyNbH+swK1QxOLTkxURnmxiyTOTi+W6xtHtoaLyFZrjPgRXYj w1+BL/fU5nl0Y9FidRAFAuYNzYcO46UmRiqwh3+KO7UXyK9oUT7j3dscqc5OHYaXVIbYTj 0r7ldx/OU0NEfRY67L+o5T2v5CLxw2M= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=126.com header.s=s110527 header.b=MYXMqZXe; spf=pass (imf01.hostedemail.com: domain of wonder_rock@126.com designates 123.126.96.242 as permitted sender) smtp.mailfrom=wonder_rock@126.com; dmarc=pass (policy=none) header.from=126.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1669210858; 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:references:dkim-signature; bh=x8W5fh9VbHoZWZ6ymIAUg8ezurxWq9/jC6mUoLoDw1Q=; b=VeuyGtKN3V56//A01kW7jFmJyr0fJeJHNFzv3OAJ5LZfIfvngDIedFSsC2vsxnEBAhNACu dBoqo0CDy8dzbVKw9MBl30ECsKSFXvAVp2sWPrYdzxygQpGUBtxEo9JtWBdozatS1EfivG BtM5E8asjc5tZ2TJHLRDlt5qiZUoEyM= X-Stat-Signature: cdzdzmfj79rzticzcjp71fyssdqxth68 X-Rspamd-Queue-Id: 396EC40005 X-Rspam-User: Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=126.com header.s=s110527 header.b=MYXMqZXe; spf=pass (imf01.hostedemail.com: domain of wonder_rock@126.com designates 123.126.96.242 as permitted sender) smtp.mailfrom=wonder_rock@126.com; dmarc=pass (policy=none) header.from=126.com X-Rspamd-Server: rspam02 X-HE-Tag: 1669210856-856112 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: From: Deyan Wang It is safe to get_pfnblock_migratetype() in critical section, so just call get_pfnblock_migratetype() once. Signed-off-by: Deyan Wang --- mm/page_alloc.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 6652df1f5cc8..c7ba9d65d1c0 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -1704,13 +1704,8 @@ static void __free_pages_ok(struct page *page, unsigned int order, if (!free_pages_prepare(page, order, true, fpi_flags)) return; - migratetype = get_pfnblock_migratetype(page, pfn); - spin_lock_irqsave(&zone->lock, flags); - if (unlikely(has_isolate_pageblock(zone) || - is_migrate_isolate(migratetype))) { - migratetype = get_pfnblock_migratetype(page, pfn); - } + migratetype = get_pfnblock_migratetype(page, pfn); __free_one_page(page, pfn, zone, order, migratetype, fpi_flags); spin_unlock_irqrestore(&zone->lock, flags);