From mboxrd@z Thu Jan 1 00:00:00 1970 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 09A54C433FE for ; Tue, 22 Nov 2022 09:09:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9B1DE8E0001; Tue, 22 Nov 2022 04:09:20 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 9622A6B0073; Tue, 22 Nov 2022 04:09:20 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 82A3E8E0001; Tue, 22 Nov 2022 04:09:20 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 73ACC6B0071 for ; Tue, 22 Nov 2022 04:09:20 -0500 (EST) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 4BCFD80884 for ; Tue, 22 Nov 2022 09:09:20 +0000 (UTC) X-FDA: 80160504480.28.48D3E37 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by imf26.hostedemail.com (Postfix) with ESMTP id ADB5E14000F for ; Tue, 22 Nov 2022 09:09:19 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 23CCE21AA4; Tue, 22 Nov 2022 09:09:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1669108158; h=from:from:reply-to: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:in-reply-to:references:references; bh=ocCid8suFZ26SdTlwmD1wR7HL2ZEAq1UzTulsf3Qe8E=; b=bLyIFTAL66Q30UrOUCHfIPqdGW4SgNN75jyI1vPJSwD2zBUkv/APrv3jG+veV2j0YTloFg vm5Raf8QUD2KN/R3KjkGDSRuwdxdglWniwut5od3FVFICKFhQmwDxbgClYH+7VOhRcJaWV NMiwVXNMsPXlMe/awgv85sfW43EWVpo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1669108158; h=from:from:reply-to: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:in-reply-to:references:references; bh=ocCid8suFZ26SdTlwmD1wR7HL2ZEAq1UzTulsf3Qe8E=; b=7RHZfr6i0aOxagzBwntuqScPiFooH29odnJGUpIZvPDISam/lHF4klXDbr6UxRWXpFPogd tmL0WyqYByKUvMDA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id E435713B01; Tue, 22 Nov 2022 09:09:17 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id l2rhNr2RfGO4MAAAMHmgww (envelope-from ); Tue, 22 Nov 2022 09:09:17 +0000 Message-ID: <47e50136-eded-fbf4-4b63-7bf88b7fd791@suse.cz> Date: Tue, 22 Nov 2022 10:09:17 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.5.0 Subject: Re: [PATCH 2/2] mm/page_alloc: Leave IRQs enabled for per-cpu page allocations Content-Language: en-US To: Mel Gorman Cc: Andrew Morton , Hugh Dickins , Yu Zhao , Marcelo Tosatti , Michal Hocko , Marek Szyprowski , LKML , Linux-MM References: <20221118101714.19590-1-mgorman@techsingularity.net> <20221118101714.19590-3-mgorman@techsingularity.net> <20221121120121.djgvgm5bsklgfx7c@techsingularity.net> From: Vlastimil Babka In-Reply-To: <20221121120121.djgvgm5bsklgfx7c@techsingularity.net> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1669108160; a=rsa-sha256; cv=none; b=c2nwEC9gh9IbkqyEPTm4t4FPFuiSEH7pGklNRPPQf9q50Lq+5MPwckVKL8eHJ1fR5uNtSt BFi3r7U+IO8YlOMYcawhQMvyqNlshCZe6EbIZnCdbWBp90J/76e7uRw4n4UYYFJJDvqHNm EJ0n8UpDoBzYQoaOTqsapIPnOPeFr9Q= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=bLyIFTAL; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=7RHZfr6i; dmarc=none; spf=pass (imf26.hostedemail.com: domain of vbabka@suse.cz designates 195.135.220.28 as permitted sender) smtp.mailfrom=vbabka@suse.cz ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1669108160; 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:in-reply-to:references:references:dkim-signature; bh=ocCid8suFZ26SdTlwmD1wR7HL2ZEAq1UzTulsf3Qe8E=; b=iV3lTp4JbsvgGN9ABLFXZahdSe6M8K6Agv1+IqWmdSAdHCoRPYVihhnmgrLugYyoEwv4+x L8kY0aDfh+u5VInDJt0jDSECoiEXoUcYC1T0ReJZMrefAMbNPLTkaAD2w2MhfscK5rNBkH 4EDcbavjRjuEUNkBEi+TOH59WXeFWIs= X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: ADB5E14000F X-Rspam-User: Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=bLyIFTAL; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=7RHZfr6i; dmarc=none; spf=pass (imf26.hostedemail.com: domain of vbabka@suse.cz designates 195.135.220.28 as permitted sender) smtp.mailfrom=vbabka@suse.cz X-Stat-Signature: h68ohfcw89hddngfjgcd6xqtxqz4fe59 X-HE-Tag: 1669108159-496500 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: On 11/21/22 13:01, Mel Gorman wrote: > On Fri, Nov 18, 2022 at 03:30:57PM +0100, Vlastimil Babka wrote: >> On 11/18/22 11:17, Mel Gorman wrote: > > While I think you're right, I think it's a bit subtle, the batch reset would > need to move, rechecked within the "Different zone, different pcp lock." > block and it would be easy to forget exactly why it's structured like > that in the future. Rather than being a fix, it could be a standalone > patch so it would be obvious in git blame but I don't feel particularly > strongly about it. > > For the actual fixes to the patch, how about this? It's boot-tested only > as I find it hard to believe it would make a difference to performance. Looks good. Shouldn't make a difference indeed. > > --8<-- > mm/page_alloc: Leave IRQs enabled for per-cpu page allocations -fix > > As noted by Vlastimil Babka, the migratetype might be wrong if a PCP > fails to lock so check the migrate type early. Similarly the !pcp check > is generally unlikely so explicitly tagging it makes sense. > > This is a fix for the mm-unstable patch > mm-page_alloc-leave-irqs-enabled-for-per-cpu-page-allocations.patch > > Reported-by: Vlastimil Babka > Signed-off-by: Mel Gorman Acked-by: Vlastimil Babka > --- > mm/page_alloc.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/mm/page_alloc.c b/mm/page_alloc.c > index 323fec05c4c6..445066617204 100644 > --- a/mm/page_alloc.c > +++ b/mm/page_alloc.c > @@ -3516,6 +3516,7 @@ void free_unref_page_list(struct list_head *list) > struct zone *zone = page_zone(page); > > list_del(&page->lru); > + migratetype = get_pcppage_migratetype(page); > > /* Different zone, different pcp lock. */ > if (zone != locked_zone) { > @@ -3530,7 +3531,7 @@ void free_unref_page_list(struct list_head *list) > */ > pcp_trylock_prepare(UP_flags); > pcp = pcp_spin_trylock(zone->per_cpu_pageset); > - if (!pcp) { > + if (unlikely(!pcp)) { > pcp_trylock_finish(UP_flags); > free_one_page(zone, page, page_to_pfn(page), > 0, migratetype, FPI_NONE); > @@ -3545,7 +3546,6 @@ void free_unref_page_list(struct list_head *list) > * Non-isolated types over MIGRATE_PCPTYPES get added > * to the MIGRATE_MOVABLE pcp list. > */ > - migratetype = get_pcppage_migratetype(page); > if (unlikely(migratetype >= MIGRATE_PCPTYPES)) > migratetype = MIGRATE_MOVABLE; > >