From patchwork Fri Aug 18 06:05:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Li X-Patchwork-Id: 13357382 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 B194DC05052 for ; Fri, 18 Aug 2023 06:06:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6D3A2940055; Fri, 18 Aug 2023 02:06:03 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 68099940009; Fri, 18 Aug 2023 02:06:03 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 521DB280055; Fri, 18 Aug 2023 02:06:03 -0400 (EDT) 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 4107D940009 for ; Fri, 18 Aug 2023 02:06:03 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 18FE4B1BAD for ; Fri, 18 Aug 2023 06:06:03 +0000 (UTC) X-FDA: 81136189806.06.6E0B0BB Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf25.hostedemail.com (Postfix) with ESMTP id 5724BA000E for ; Fri, 18 Aug 2023 06:06:00 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=qf6UYoy4; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf25.hostedemail.com: domain of chrisl@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=chrisl@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1692338760; 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:content-transfer-encoding:in-reply-to: references:dkim-signature; bh=7uIz4YGa163upApoGgD/9PBk+TLkaYkXcNLINrl5MaY=; b=s3Q7ZxjhDNchMGZ0j03IAnDStcgTOV8pE1+zcZ2U7n2tjBiC25hccnYxRzoUYlJSRuB6p4 /KF6dKnW8MZNglMgtH/3FHuh5ZCSwUlRApvCS2E0IuxJPqN+wLwEObS6LvdgmvMHg7wePT OwI32qqzNaPjYEo5GKGd0p9l24kFNWE= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=qf6UYoy4; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf25.hostedemail.com: domain of chrisl@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=chrisl@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1692338760; a=rsa-sha256; cv=none; b=tZdGCk6iTE7jbRS+w18BPbGPTU3uOROO1gDBXxRnERrKfpPLk8U0cufmqzLlDPTptH/Iv1 D+YiIqC1BHEnYpF0UU2s/uqlE/9Ap/z9/hjSY6F8oyJVUW5uJak4/DtUXLFFMIXNe42OCE D1pflej59UBvbI88EEAodq9mBmQzpR8= Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5C50663BB7; Fri, 18 Aug 2023 06:05:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 64765C433C7; Fri, 18 Aug 2023 06:05:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1692338758; bh=n3BpoIeXq9CIvchSKrnmLWQgVA9pvqrLHqMRQFzVdPM=; h=From:Subject:Date:To:Cc:From; b=qf6UYoy4G2GFHC+FPZaU6nW5AW6/PaBH31SVWSJYJuhaqcz7kM98evR3UgnTRSvg+ P7J25H25cjWWjZ2VhobHehDhYHip9S+h7x5eqG21ZfX0AgPJ0rtORj+Slfqr6yDld7 BRe3hylKMZymiiMxU+D18Ywo2uR837j9htNLywdhYRaeXOe89+D2PRsrz58xhHLJSb AkKDgAC7eChRLps+5OBOws9Qx4H+VKxR14Vwk3dznINlpPqKciTQunaZ7ZwUdO8tuu nxDABbxQMRoH4rf7H0Yrqc616qIqYFAu4naHvmxIZ/h4fSgN+HxwlkG2lu4CVK3409 N+RFoIkhD0iZQ== From: Chris Li Subject: [PATCH RFC 0/2] mm/page_alloc: free_pcppages_bulk safeguard Date: Thu, 17 Aug 2023 23:05:22 -0700 Message-Id: <20230817-free_pcppages_bulk-v1-0-c14574a9f80c@kernel.org> MIME-Version: 1.0 X-B4-Tracking: v=1; b=H4sIACMK32QC/x2NQQqDMBQFryJ/3YCxUKXbQg/QbSnyE180VGPIr 1IQ797Y5TAMs5EgeQhdi40SVi9+Dhn0qSA7cOihfJeZqrI6l42ulUtAG22M3ENas4xv5dha3XQ XB9SUQ8MCZRIHOxzpNCn5sBlxuJjg/Pc/fNLjfqPXvv8AU1Y79oUAAAA= To: Andrew Morton , Kemeng Shi Cc: akpm@linux-foundation.org, baolin.wang@linux.alibaba.com, mgorman@techsingularity.net, Michal Hocko , david@redhat.com, willy@infradead.org, linux-mm@kvack.org, Namhyung Kim , Greg Thelen , linux-kernel@vger.kernel.org, Chris Li , John Sperbeck X-Mailer: b4 0.12.2 X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 5724BA000E X-Stat-Signature: k51en4rs8rdrqu88ti7jgnm3opu7zdwu X-HE-Tag: 1692338760-316846 X-HE-Meta: U2FsdGVkX19AdEk8xvSR3vzDqoVIYtqw2je5upPGZt69PQ1Eoacruq/c4OFYg2EFjGz9e4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ne9/JAhUO9COC41VL6A7g2zJtBkjq31X8Sd3fb9uTajviZYQlW+7kaXcVkX3oFJ16KiJNDGQMs0OiaDcukLuucaJD01Xw4GZ2oJf+VRQ4k2m48aYCy6I3MyhKvlbfnBbkEilpbk76xXji+JuZRBXOD52kBSD275RafsZoURDStgKI2LwjFNDjNiAd6eT9kGbdHmhxl11b/AsxpgtQaVEUhTYNIoPLiym9kz4iwlvzMcmR8cNFfw= 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: In this patch series I want to safeguard the free_pcppage_bulk against change in the pcp->count outside of this function. e.g. by BPF program inject on the function tracepoint. I break up the patches into two seperate patches for the safeguard and clean up. Hopefully that is easier to review. Signed-off-by: Chris Li --- Chris Li (2): mm/page_alloc: safeguard free_pcppages_bulk mm/page_alloc: free_pcppages_bulk clean up mm/page_alloc.c | 44 +++++++++++++------------------------------- 1 file changed, 13 insertions(+), 31 deletions(-) --- base-commit: 5fb2ea3111f4ecc6dc4891ce5b00f0217aae9a04 change-id: 20230817-free_pcppages_bulk-facc18d6fee7 Best regards,