From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CA0FD606A31A for ; Wed, 2 Dec 2026 03:24:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=N8qQmKLL Received: by kanga.kvack.org (Postfix) id E6D7D6B0638; Tue, 1 Dec 2026 22:24:22 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E196A6B0639; Tue, 1 Dec 2026 22:24:22 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D076D6B063A; Tue, 1 Dec 2026 22:24:22 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 9E99B6B0638 for ; Tue, 1 Dec 2026 22:24:22 -0500 (EST) Received: from smtpin12.hostedemail.com (lb01a-stub [10.200.18.249]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 595371401A4 for ; Wed, 2 Dec 2026 03:24:21 +0000 (UTC) X-FDA: 85497599922.12.37C91C8 Received: from sea.source.kernel.org (sea.source.kernel.org [172.234.252.31]) by imf05.hostedemail.com (Postfix) with ESMTP id B7D93100009 for ; Wed, 2 Dec 2026 03:24:19 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20260515 header.b=N8qQmKLL; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf05.hostedemail.com: domain of harry@kernel.org designates 172.234.252.31 as permitted sender) smtp.mailfrom=harry@kernel.org ARC-Seal: i=1; a=rsa-sha256; d=hostedemail.com; s=arc-20220608; cv=none; t=1796181859; b=zTXFGsLz3FiO7sAKJZlf1lR8RiGo/0VYmgqFWxlB/ko5EurAMnbs8+bqAus7gv0gDbaBu5 UhakBUND9COhv11Gl9EEDEFtdEyYLgegbjUBfo3Jz2fSj7KuToH6WxMApqdF05fCNLofg2 cS2M/Hh7Art8zBO4f6prtqcM0s5/nac= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1796181859; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=yQaYzu/8ntFdAmHysnCFZPWCP/6VV5d5aymOwYOLITM=; b=jCR5gjn3irf5+Azoaime21VeQmi00LYF3ef6eFJcPZt6rjjLFOs3tmNFexctQdGlBgOYnJ U+ucudtBI2WE5bKhrRhbQmNNsEue1clBweQCC3YdPLQuxsPblOps/6bPr8pBqHI6CyCmDi jygAse6OQkloUEdR4iJfgpqrkyFwy84= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20260515 header.b=N8qQmKLL; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf05.hostedemail.com: domain of harry@kernel.org designates 172.234.252.31 as permitted sender) smtp.mailfrom=harry@kernel.org Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id 2EE7742469; Wed, 2 Dec 2026 03:24:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 944ED1F000C1; Wed, 2 Dec 2026 03:24:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796181858; bh=yQaYzu/8ntFdAmHysnCFZPWCP/6VV5d5aymOwYOLITM=; h=Date:From:To:Subject:References:In-Reply-To; b=N8qQmKLLkdK4VF7X3PsbfQ8CkzxDIMFD89dPdRBfh0T2eKBs7+jnzysV1uvRXObNA Hn47JHp/CSHu0SX71Hxr3sEeK+jBtO+k+sh1IOUjZugvpBRF5h01esQJD/bklHi/8v vgfd90vpa4LgUhhvfiEzE0qoA8S10YzUbERZaAwq/83layUob+YFr2TUcwF16RBDkH 9rJFIxkrpuf4roXXv6bdTg1LdMJx+kUFjuw51koqWhYD0NWR7R0OD2JuGN/7c7OKVc 1aXmbMEtgEFzpYOZIIU5BXLuOYye6Wy8EKoCkNa/pFAv7ShvuT4lcuqMp9lQ3UteGv 9iTOqtDi+WzMg== Date: Wed, 2 Dec 2026 03:24:16 +0000 From: Harry Yoo To: Andrew Morton , Vlastimil Babka , Johannes Weiner , Suren Baghdasaryan , Michal Hocko , Brendan Jackman , Zi Yan , Mel Gorman , linux-mm@kvack.org, kernel-team@meta.com Subject: Re: [PATCH 0/3] mm/page_alloc: drop the pcp lock before re-enabling IRQs Message-ID: References: <20261125212730.1128631-1-joshua.hahnjy@gmail.com> <20261201161138.294531-2-joshua.hahnjy@gmail.com> <20261201213125.294531-5-joshua.hahnjy@gmail.com> X-Archived-By: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: B7D93100009 X-Stat-Signature: s46h96jqwiwiufy1uqngyf8ht5fjr63q X-Spam-Status: No, score=-5.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_PASS,SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Rspam-User: X-Rspamd-Server: rspam04 X-HE-Tag: 1796181859-909778 X-HE-Meta: U2FsdGVkX1+7V1UJb0cO0ZtCqDMGzRzDdMTzhP6fXbCaGik7WP4T6hmlHqg43168U5D4Fl2JmXmUsheoc9cFAtXBQ+6YB0q8VT8w1x51mc9dp8aT5a6ybIR/0BNQOvQfJdp4jqZmXHOHlFFlQcpOPE5ixrTRY8oCwN72wTZGkdy37/HCpFN8Qw8rQL9ARVnY1RasDpcyh7pUmhoLpCCsWNmj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JAfDPG27LuKuXrWiiblO+rkxnqnCjwnLD7eVSrE5v3fJEYtgj152/Qy0qZhE1nN4mx/fgQSpgsbv7YypJqFJmImfqEPkyfDQqbtqQHxR5xYNpg2IC+hTUJzkgDfBM/lmbk6kUi+icdJb10+TUyCq4wTjMK/ubVhpOA6+KX9Hf+seRhbpkJSYdD3xz/Hk8H5V5ARZNB4efVBZ89HPZjiwPWaf0NvVhdg== Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 On Tue, Dec 01, 2026 at 11:53:48PM +0000, Harry Yoo wrote: > On Tue, Dec 01, 2026 at 02:05:57PM -0800, Joshua Hahn wrote: > > > > The PCP lock is already complicated and now we're trying to add more > > > > complexity only to avoid disabling and enabling IRQ around the PCP > > > > lock in the common path. > > > > > > > > We should probably revisit the tradeoff made in [1] instead of adding > > > > more complexity, what do you think? > > > > > > Yeah, I think this is very reasonable :p It does seem like a lot to > > > remember about when the IRQ is enabled / disabled and who needs to > > > remember what... I also did not really like the fact that the locking > > > and IRQ toggling wouldn't be FILO if we switched the order of the > > > pcp unlock and IRQ enabling. > > > > > > Anyways, let me do some benchmarking to revisit the cost and the > > > tradeoffs. It would essentially be a revert of Mel's commit but I think > > > there's been a lot of changes on top of it over the years, it might > > > be a bit more plumbing than a simple revert. > > > > Hey Harry, so I did some quick prototyping with AI (diff at the end). > > We don't need pcpu_task_pin()/unpin() if we disable IRQs Sorry this is not exactly something we've had in the past, so I need to describe it further. > and so the > regression might be overestimated as we disable migration AND IRQs. It's not "overestimated" in terms of measuring performance of the revert... but it's still silly to disable both preemption and IRQs and we can probably do better here. pcp_spin_trylock() on !RT should disable IRQs first and then call spin_trylock(). on RT it should disable migration and then call spin_trylock(). This avoids allocating pages from a different CPU's PCP by mistake due to task migration. -- Cheers, Harry / Hyeonggon