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 75C20606A322 for ; Tue, 1 Dec 2026 23:53:52 +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=gAJ2gas6 Received: by kanga.kvack.org (Postfix) id 7891D6B062C; Tue, 1 Dec 2026 18:53:51 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 712426B062D; Tue, 1 Dec 2026 18:53:51 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 606EA6B062E; Tue, 1 Dec 2026 18:53:51 -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 36FF96B062C for ; Tue, 1 Dec 2026 18:53:51 -0500 (EST) Received: from smtpin01.hostedemail.com (lb01a-stub [10.200.18.249]) by unirelay06.hostedemail.com (Postfix) with ESMTP id C6855A665C for ; Tue, 1 Dec 2026 23:53:50 +0000 (UTC) X-FDA: 85497069420.01.626C1BD Received: from tor.source.kernel.org (tor.source.kernel.org [172.105.4.254]) by imf13.hostedemail.com (Postfix) with ESMTP id 1E2BA2000D for ; Tue, 1 Dec 2026 23:53:48 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20260515 header.b=gAJ2gas6; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf13.hostedemail.com: domain of harry@kernel.org designates 172.105.4.254 as permitted sender) smtp.mailfrom=harry@kernel.org ARC-Seal: i=1; a=rsa-sha256; d=hostedemail.com; s=arc-20220608; cv=none; t=1796169229; b=VcKjibHcpWWpzILDVVYPSogbNtChPqnPQAXS9RDOsLao6z0ig60ZraYr5jmyQumpjeE9QY 9iPhiCo/1RsayiKeF2E9+65KsSj22Rd733B5CXUWXUgKKq9pGGz/WIRpF6uzEtzjXel2cv A1MfHEACMFZEL8Mu9/Ndnb98B6TJOSI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1796169229; 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=V3afrxeABYou7KAC31jJuNbAhnBHWzLniigRFcgMogc=; b=tS1MsB5xvmS6xW+n+Ou0Giw+XCWlZf43NrY2dw1V4ASuMaRNGg6d4i6RdjHyZJGZLYU5w2 E5f+bbBN6ESviRuY+mhcwlrNuIhSFIfBAVe9fkKOfr/fM6gJxzSupWiSF2U51nEDDEjs3G JliKk37QRYr5e1tKoalvwv2SQlZ9OdI= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20260515 header.b=gAJ2gas6; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf13.hostedemail.com: domain of harry@kernel.org designates 172.105.4.254 as permitted sender) smtp.mailfrom=harry@kernel.org Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id D6650625FC; Tue, 1 Dec 2026 23:53:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 181FA1F00893; Tue, 1 Dec 2026 23:53:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796169227; bh=V3afrxeABYou7KAC31jJuNbAhnBHWzLniigRFcgMogc=; h=Date:From:To:Subject:References:In-Reply-To; b=gAJ2gas6R5ei1XAGUKWGn50dt+pA4m2b6aHaEgwT24+Lz/d/JPQ7jzbS8S4hztRSM rZxlTRFavGabiu+m/AphmoUWBXsPTGm8bHRJje2L4swpWgqkrF9OOoBOgUbSoNbqc6 wuGHXjj35yhwtD5KxzuHgXJUsCHKwiZCjPjnLtwzu3DQ8I6YUprsnnemwWU0a8AHP/ LcRG45eKeNJDilTBnfsG1hgMHuwUub5++wjkY7VwW/e/eHMEcvavuzy0BIWqasadQ8 +cRz9oD9VsuvVQkmhOkfH/VIe+gLlB8GIXkuoTwAwK+M/942xyVLHYY4MMNKhefbgU uCRYUz9v51mxw== Date: Tue, 1 Dec 2026 23:53:45 +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: <20261201213125.294531-5-joshua.hahnjy@gmail.com> X-Stat-Signature: bd6oibxqn8hbocgkw696at3tzuk6szfh X-Rspam-User: X-Rspamd-Queue-Id: 1E2BA2000D X-Rspamd-Server: rspam12 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-HE-Tag: 1796169228-453545 X-HE-Meta: U2FsdGVkX1/K3SDhQpFRgOqeMKgg+ILWd0d9z9fSMoSSPKPbwk4S+F+nnYsNz6TtNQ2Hpw9XoHVCVSh0A2vexOnGxWb57E1mP0bgCykWRrRigyIbI7qCP+1mtWrNRJ1pm8p9chNmwnmiEJnNmn8uGFXk0egCpbitvc1JOCcQxyk4WblRqpSECVTdgPRZUaxZ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FRfESM12TDn9ac6u/vr4yJbTFMnHMkLTtrcFQCoST8nFa3nlgd2sU5R29yHsjzCmW4EnmRBKsBs7LgugxM1geiEBIE0EM4sYp/AinklE9gOxbLxvkow8OCGxGuze7RfYqm9pWvGXvabqyxiQTNoypQwifaJfDi+B1zsaVccELF/IDA2URxX4v/jgMDpXblLih7LbbedGSYlgfLozzlv+JaAVKAOEuUIUY4MOmDABmg0qIb+uYUBTgjfr/P01P/djNFg== 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 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 and so the regression might be overestimated as we disable migration AND IRQs. We don't need _nopin() variant either. > So first, disabling IRQs for pcp locks resolves the issue I was seeing > of pcp lock attempts falling back to the zone lock. From userspace > this would show up as long softirqs. I re-ran the same benchmark I used > for the cover letter: > > "series" is this 3-part series, "revert" is the diff at the end. > > +-------------------+--------+--------+--------+ > | | mm-new | series | revert | > +-------------------+--------+--------+--------+ > | pcp fallbacks | 136839 | 214 | 0 | > | callback avg (ms) | 14.6 | 0.6 | 0.6 | > | softirqs > 65ms | 1059 | 31 | 37 | > +-------------------+--------+--------+--------+ > > I guess this is to be expected though. > > The next benchmark is about the fast-path cost, which is what Mel's > commit originally set out to save. I ran David's benchmark with > one alloc_pages() and __free_pages() on a single CPU. The results are > median nanoseconds over 30 runs: > > +---------+--------+--------+--------+ > | | mm-new | series | revert | > +---------+--------+--------+--------+ > | order-0 | 80 | 81 | 84 | > | order-1 | 80 | 80 | 88 | > | order-3 | 86 | 86 | 95 | > +---------+--------+--------+--------+ > > So yeah, there is indeed some regression based on my microbenchmark, > somewhere between 5% to 10%. This should be the worst-case scenario, > though. I also ran will-it-scale, this one measures faults per second > so higher is better: > > +-------------+--------+--------+--------+ > | | mm-new | series | revert | > +-------------+--------+--------+--------+ > | page_fault1 | 1.081M | 1.080M | 1.051M | > | page_fault2 | 0.756M | 0.760M | 0.752M | > +-------------+--------+--------+--------+ > > And here it seems like the regression is a bit smaller (< 3%). Also note > that between 16 to 128 tasks there wasn't much of a measurable > difference. Could you please share statistics for each number of processes next time you measure it? -- Cheers, Harry / Hyeonggon