From patchwork Wed Apr 2 07:41:16 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Songtang Liu X-Patchwork-Id: 14035618 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 7FB6CC28B20 for ; Wed, 2 Apr 2025 07:41:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 01CDE280005; Wed, 2 Apr 2025 03:41:20 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id F0D08280001; Wed, 2 Apr 2025 03:41:19 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DD699280005; Wed, 2 Apr 2025 03:41:19 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id BF9C2280001 for ; Wed, 2 Apr 2025 03:41:19 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 5CE0B1412F2 for ; Wed, 2 Apr 2025 07:41:21 +0000 (UTC) X-FDA: 83288308362.04.B755020 Received: from mail-pj1-f48.google.com (mail-pj1-f48.google.com [209.85.216.48]) by imf16.hostedemail.com (Postfix) with ESMTP id CB40D180004 for ; Wed, 2 Apr 2025 07:41:18 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b="Zg4SJ/ZS"; dmarc=pass (policy=quarantine) header.from=bytedance.com; spf=pass (imf16.hostedemail.com: domain of liusongtang@bytedance.com designates 209.85.216.48 as permitted sender) smtp.mailfrom=liusongtang@bytedance.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1743579679; a=rsa-sha256; cv=none; b=sz3IhxsTiYntJNJNu58jYf7+2ApRtOZQZsdx6WrkmuI+E6huq3txtv7OiAPdw0pGJZ43Tz +9GGRt18g92ZckbIvF08QXTKnkJ5eZf64KItaECT7+6b1dLcMOaYTtwYKx2TZQmHVEHbQz tuBbOZLUz1r+O5TQPcn1sw3P7WZX13A= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b="Zg4SJ/ZS"; dmarc=pass (policy=quarantine) header.from=bytedance.com; spf=pass (imf16.hostedemail.com: domain of liusongtang@bytedance.com designates 209.85.216.48 as permitted sender) smtp.mailfrom=liusongtang@bytedance.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1743579679; 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:in-reply-to: references:dkim-signature; bh=4i96T5V9k3vmZpu844wwAM9EtCVL0KJkJhUh5REbcPQ=; b=OVfv2IZPKPPjcbWZ95vA7BBYSaT8XdZG4G0eJBTHuj7lP/OoaD2emt2X1DXlyPqH6WE8jJ +41M+w90J8riu6LA4ZzszRlEG1bCHWjYRFLLkFlOHBaV41rK1DS22o50LKjS2yOFVmu6m6 pCwqFwK4to9HFcn1xkR/l3VQZPx7nLg= Received: by mail-pj1-f48.google.com with SMTP id 98e67ed59e1d1-30155bbbed9so8444320a91.1 for ; Wed, 02 Apr 2025 00:41:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1743579677; x=1744184477; darn=kvack.org; h=cc:to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=4i96T5V9k3vmZpu844wwAM9EtCVL0KJkJhUh5REbcPQ=; b=Zg4SJ/ZSIFTHgf7EAyJ4+z2Pqc5rJTKjlyYVUPpGssARGylQRYWz36D5KFTKSplh+g j3/y27wa13DXKt4gUCo6vldP6rLd6lKT6R2Ax5Kfu0MstKddw9lSX078wCLcM+17Zpmk +H/s7m3+9MoE0Lu+YpYksNFCpioco9U4p0MY8GVCh0iOW0Wtbie3TFohDAQMNBRmLbLi UAM0+kOMFsXLdfBgo155JGqQqgr/Hp2NURhzSYd334iq3yLTYlcRYNXhv0tbRXit7e2C gH8i/+/oMRzAHdzfUf7FZq90vKheKFSEKO8Jw9p3MTyuRLM66zZlffpLxgqkMeKCxy18 9pcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743579677; x=1744184477; h=cc:to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=4i96T5V9k3vmZpu844wwAM9EtCVL0KJkJhUh5REbcPQ=; b=r6kgU6QqWgxI3cRuOQsRuPW9fy6Dhl3mANX17XwWknSm3tMsH3e1qKEspYV86VfPDq oc+d9+4Q69+DYCjHnh+lyHIuBp8SqARR864fy6YoVQPfDDMHvhYDBd1JkucMd9B0iCCw B/MXkyTdLu3Czmtu/E62EkT0K6i/AeCaSRlW/EEWvNbukJWYopruaIhcLQzWKOjSvBA1 z3y3edQMwdJ6DysiCxywj0x9LYwNuGrbqqv3fDdEnZ8jXdqer/q1+TYlJQ2ic8Qt3JtF NkYMlY6XhMnU6MuB0CmQai9zSdnYsAyh3aXlOroqzzlpi4z3ULG0eifmKyZDvFlc0ZSS txhw== X-Gm-Message-State: AOJu0YxuyBLhDhThwUGJz6u5KRofnQKNOj8JhwuGWm7Ty1CrpmZB9o3D kBVeVVmpEFXJ8CTssH5Rfm7Eo+AZbQwp0x+UtkdIocjT2guIY3w8FRwkfML3aWN6bR7asOKMv/i Zj2gNP8ThPHGybXRQFydZOGsPu9z8Qyx4F69lVQ== X-Gm-Gg: ASbGncuntLX196n9qqZzsGSQcGdnVOhT5J7faNSvy0zu2Eo/Nn/+u2j7jc7lHIs5827 T3orkqyaXsshTX/nFLPEQr3GCsdsFuZXnnaryk2wN4VJRJRlYjjq/pAx7h1ovM6dlnXqTxAtLYj dksvgb5dTjnEPLglYiBoXk70yCnwnO X-Google-Smtp-Source: AGHT+IGm9Y961h45rVaXB5V314Bn0z+G+3R2yIWCaHEVb/7THBOWkoIKipQJc2UaOxlfeUkCHApw8UKveBTn3FEuvh0= X-Received: by 2002:a17:90b:51c3:b0:2fe:8a84:e033 with SMTP id 98e67ed59e1d1-3056085c01cmr9342886a91.2.1743579677410; Wed, 02 Apr 2025 00:41:17 -0700 (PDT) Received: from 44278815321 named unknown by gmailapi.google.com with HTTPREST; Wed, 2 Apr 2025 03:41:16 -0400 Received: from 44278815321 named unknown by gmailapi.google.com with HTTPREST; Wed, 2 Apr 2025 03:41:16 -0400 X-Original-From: Songtang Liu Mime-Version: 1.0 X-Mailer: git-send-email 2.20.1 From: Songtang Liu Date: Wed, 2 Apr 2025 03:41:16 -0400 X-Gm-Features: AQ5f1Jpq9pj52as74KFEAbnUi6bgkoodsPYmo63WpbfX_F6JJmM_VLu1PGhAMM0 Message-ID: Subject: [PATCH] mm: page_alloc: Remove redundant READ_ONCE To: akpm@linux-foundation.org, ying.huang@linux.alibaba.com Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, zhengqi.arch@bytedance.com, songmuchun@bytedance.com, Songtang Liu X-Rspam-User: X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: CB40D180004 X-Stat-Signature: y7thnpgmdadr4d8phfbhr9mj7rm9zsp8 X-HE-Tag: 1743579678-238826 X-HE-Meta: U2FsdGVkX19cUrwsPskk31LDyUBvXfPZMH2ROgH3tjX103LRSbfpwxLR73uDRHkkY0DiKeJzKf4Fm9CO0fL8yvwx3oLW/eKZWgKvdVUjPBTJP8ZinVjdwFNXriTpNQA7WDrxfmXADW1ztYGnVMqJ9Er5eWC69Eh3fwdH9HZog9OZVX+q6GzPAPoyzsgSSPwMEtkM7yw8sZbGaE4m2HnuX5M2x6TbxWn25aIG8K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GjnE7VmDg= X-Bogosity: Ham, tests=bogofilter, spamicity=0.100939, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: In the current code, batch is a local variable, and it cannot be concurrently modified. It's unnecessary to use READ_ONCE here, so remove it. Fixes: 51a755c56dc0 ("mm: tune PCP high automatically") Signed-off-by: Songtang Liu Reviewed-by: Qi Zheng Reviewed-by: Huang Ying Reviewed-by: Anshuman Khandual Reviewed-by: Pankaj Gupta Reviewed-by: Oscar Salvador Reviewed-by: Vishal Moola (Oracle) --- mm/page_alloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index e3ea5bf5c459..6edc6e57d4f8 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -2661,7 +2661,7 @@ static void free_frozen_page_commit(struct zone *zone, free_high = (pcp->free_count >= batch && (pcp->flags & PCPF_PREV_FREE_HIGH_ORDER) && (!(pcp->flags & PCPF_FREE_HIGH_BATCH) || - pcp->count >= READ_ONCE(batch))); + pcp->count >= batch)); pcp->flags |= PCPF_PREV_FREE_HIGH_ORDER; } else if (pcp->flags & PCPF_PREV_FREE_HIGH_ORDER) { pcp->flags &= ~PCPF_PREV_FREE_HIGH_ORDER;