From patchwork Fri Dec 6 11:23:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qi Zheng X-Patchwork-Id: 13897057 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 C1DE9E77173 for ; Fri, 6 Dec 2024 11:25:09 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3AB256B018C; Fri, 6 Dec 2024 06:25:09 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 333EA8D0005; Fri, 6 Dec 2024 06:25:09 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1AEEE6B0190; Fri, 6 Dec 2024 06:25:09 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id F0BE16B018C for ; Fri, 6 Dec 2024 06:25:08 -0500 (EST) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id B069481C2E for ; Fri, 6 Dec 2024 11:25:08 +0000 (UTC) X-FDA: 82864302360.16.BC9FA82 Received: from mail-pf1-f178.google.com (mail-pf1-f178.google.com [209.85.210.178]) by imf03.hostedemail.com (Postfix) with ESMTP id 906C320015 for ; Fri, 6 Dec 2024 11:24:58 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b="juHdpc/7"; spf=pass (imf03.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.210.178 as permitted sender) smtp.mailfrom=zhengqi.arch@bytedance.com; dmarc=pass (policy=quarantine) header.from=bytedance.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1733484291; a=rsa-sha256; cv=none; b=zyVY5ki0hRftWcoTWtbsXyEMqpE06QxY5tmmxHj1xWzOu3LIfIh48dI2bcfSd9hJKyb/lw T49hssjNOLJueZRy8/z8VtIhfzu8eGZPZph5vi2z6zy3UbJe/O6JlQKlIddbudFRexVsX3 AO2kGMl92pdWAKb3rdjkw5HuD20C5Kg= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b="juHdpc/7"; spf=pass (imf03.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.210.178 as permitted sender) smtp.mailfrom=zhengqi.arch@bytedance.com; dmarc=pass (policy=quarantine) header.from=bytedance.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1733484291; 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=axS0mpcWAsMj7lGkmb/FIxmxAQmAcm2tqBZhm+ItLoE=; b=y3KTxN8rm3Se1FmGe/q9wX3ZkvH7FTvH1TmFXIT809pEhNfWpSeSpYMFoJKXQGw8ScFubD MmY46zvsxl1OdBbwuu/mAI3n5FwRvVr4IemsGS+neA4UhnV+0Ar3gLOXaSdg0hym7CK1ax RPMQB9i5rrBiptvZgya3XTEuowYrYeg= Received: by mail-pf1-f178.google.com with SMTP id d2e1a72fcca58-723f37dd76cso1758328b3a.0 for ; Fri, 06 Dec 2024 03:25:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1733484304; x=1734089104; darn=kvack.org; 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=axS0mpcWAsMj7lGkmb/FIxmxAQmAcm2tqBZhm+ItLoE=; b=juHdpc/7Xgle4v26QwB8nvtmjsitjP1KqXz9P8iAcxRD7JLx02neiXWo5Li3ahuO3z Uwnq5h2Ph+bwyLa72+huuaAq6m73UYwZRB6/0yrwuHkwy6abQ78OP+yDSdwgnzD/gNPh 4CliKXCb0F9NXTwmL6LFOef8VF1WhqZ3WBMTrNJrp1VEQrkRnbGPdh2hrmTF1k323iQ4 JSYa6eZDpKkZdvJa+AKgHPWKeMH2kcyUKtUIeO64vGR49P91K1ZKQjDVxhhVVeZ8VoDw j6ubRCtUpc/d9CRZBnpnsOT19J+Jo2Btqc7LDZAo/bZXXBCFsqL/p61kSWAdwdS50x65 vKNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733484304; x=1734089104; 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=axS0mpcWAsMj7lGkmb/FIxmxAQmAcm2tqBZhm+ItLoE=; b=VjEkXJ5tsSLs7vnapO6Yxfo/IE9jTlwVtgYTPyqEOiu+HicJmcOKkV+rETzxUbPKnU vINul2PatM5hCh4itXFE2BTUIXInOy4yihT9lbftgqEVg0a3dqdgqFiI1lWnfP//et1G +3TaV2t2MYL59w2hfRZIz95K0ZOsYw0QZgFVuBir2kEF5MagF9NLTW+OYuXzVTcnETwd PP9yU6K2ZMiVRSnpCAD05fRGm/rO/BoPaA82Y82Q5jxEoR1UyKYyH6AxT00rVmDoIR7o VuVJmtr9eYCJvxlvIEx320eGRMoO2FTD9XJQY+cQ4ThObrO0vSRDbiWvVIxWYLeVj/EB v1GA== X-Gm-Message-State: AOJu0YwRhxGLMK4Ih0Zta6hJBBs0Hn1m6nMWOgSFr68VktIy3mPTECkf T54Apgrz+wbdHfiB7j5vyURO61Cj0rXVwC7MzOt20fS3ZkGwqyEsIdQ5yWhxAMk= X-Gm-Gg: ASbGncu3sAPzqtkxk9M18/FwgHmTtHISkf83U2y3ogshKp56z2oFK3ctHFUeOInKrlt D/QYWImo3ATqCyHvpjhz817dAdS1KIV7Xg05YdLOGzjOCavSJUeqxXR975qmD8udJV1fbB2uleO to8cRORBLVqU8KuRR283+FVtzbMpPXhEbmMRKyneeXd5a4GAL7zZtHbfWgjkR6mPprvL1CVMwS+ aNDx6/GAf+/X8kkQoDpLI4JCzc04Tczggmxxv1yZcKed22UuottHE054v2kBjQSIrUVoV9lm3MV 68iE+4enfIL3Zg== X-Google-Smtp-Source: AGHT+IHzXCqK7Nq67xvQiiO8Mynf+aHH7g6jxp0vKtZyuMSGX/7uZxLiIx7gwmRGPwhfZ7cakjLiMw== X-Received: by 2002:a05:6a00:92a6:b0:71e:6c3f:2fb6 with SMTP id d2e1a72fcca58-725b80ff2f7mr4574374b3a.8.1733484304628; Fri, 06 Dec 2024 03:25:04 -0800 (PST) Received: from C02DW0BEMD6R.bytedance.net ([63.216.146.178]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-725a2a90345sm2822911b3a.109.2024.12.06.03.25.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Dec 2024 03:25:04 -0800 (PST) From: Qi Zheng To: akpm@linux-foundation.org, dan.carpenter@linaro.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Qi Zheng Subject: [PATCH v4 09/11 fix] fix: mm: pgtable: reclaim empty PTE page in madvise(MADV_DONTNEED) Date: Fri, 6 Dec 2024 19:23:48 +0800 Message-Id: <20241206112348.51570-1-zhengqi.arch@bytedance.com> X-Mailer: git-send-email 2.24.3 (Apple Git-128) In-Reply-To: <92aba2b319a734913f18ba41e7d86a265f0b84e2.1733305182.git.zhengqi.arch@bytedance.com> References: <92aba2b319a734913f18ba41e7d86a265f0b84e2.1733305182.git.zhengqi.arch@bytedance.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 906C320015 X-Stat-Signature: mjcnna111f6mc798xnaqcjkte7ufbfh8 X-Rspam-User: X-Rspamd-Server: rspam09 X-HE-Tag: 1733484298-646535 X-H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AiHxZG0YXhDlmEJimLALze98OYWtJlS0/tM7KUsPX+mVFCGuhrZeiSAdT+PrIJVVlR1fMo01TsJ4QOAxABJriDYr7vNKGnrM1tFInvg1mCiw6uQhbz/92FG/Jmtn3V6JtMGnGhnP0Ka1KtGRvXk0ZSYZYdGFaXI6QhdOr10Ncn5mtWP9wq5MLs7pyXFZm+T4o9Nw35sBE2TXoqBKpx9rjZFvhD0mH7wNXhB4xdX1vxcoWGS69NzIgrhZfWgg8mu4TaMDcaj13S1g0fGt2yRYQv10tfTHlL2tIiE3AnqXlg+jnOWHOcpe0iB6RxkyMtv96Vvr1geGzQYnc1Hj2UtGcVpuiAH0MyvOTCGYZ/Ga4GcQ+0OQ== 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: Dan Carpenter reported the following warning: Commit e3aafd2d3551 ("mm: pgtable: reclaim empty PTE page in madvise(MADV_DONTNEED)") from Dec 4, 2024 (linux-next), leads to the following Smatch static checker warning: mm/pt_reclaim.c:69 try_to_free_pte() error: uninitialized symbol 'ptl'. To fix it, assign an initial value of NULL to the ptl. Reported-by: Dan Carpenter Closes: https://lore.kernel.org/linux-mm/224e6a4e-43b5-4080-bdd8-b0a6fb2f0853@stanley.mountain/ Signed-off-by: Qi Zheng --- mm/pt_reclaim.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/pt_reclaim.c b/mm/pt_reclaim.c index 6540a3115dde8..7e9455a18aae7 100644 --- a/mm/pt_reclaim.c +++ b/mm/pt_reclaim.c @@ -36,7 +36,7 @@ void try_to_free_pte(struct mm_struct *mm, pmd_t *pmd, unsigned long addr, struct mmu_gather *tlb) { pmd_t pmdval; - spinlock_t *pml, *ptl; + spinlock_t *pml, *ptl = NULL; pte_t *start_pte, *pte; int i;