Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp601866imw; Fri, 8 Jul 2022 08:24:32 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vVa4ZLHqmXqaWYaoJPZZ5ZL5Ncoy9Hg1eibaEdIOwDl7fb+hlggUMXKTzWwMkVO3wivDT5 X-Received: by 2002:a17:906:84e8:b0:72b:2377:82a6 with SMTP id zp8-20020a17090684e800b0072b237782a6mr3887422ejb.603.1657293872288; Fri, 08 Jul 2022 08:24:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657293872; cv=none; d=google.com; s=arc-20160816; b=ugyiOXCGYUB3297P1EBREfiRpRJkaEBdjqDAnJzhwrMNLWBovQUl6csA8UP6MTBb0J Kd9RDVr6o+aOBfc5dE/jrP225L4IyVp6iFxfwANvrk741hbKUVvCxk0xKgLinGRV+PjG /WckTT5YkXLDMirMlql721wfheiTMrGWF2dDJ5dhXwzfgWx4Y/gO5T++RY5eFgS+vGcu AmHUzQg4H1c1p17PDc/8X5foPShUsJ4FI59kdPx2cDQ+L5GGXK0bxBQ4ihtq62RH24GH zt/7hgHC3Ohj8MEQ78tHqJg1n2DwbQm4hUsvfU038mC1B8AAytCVpg6A1/xIV4yvwEaK +fQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature:dkim-signature; bh=l7Aw7CUlH7hnP8Qg6TBNYPcNryVs2jtH5tretlprBAE=; b=JeinC6qivpQln8vM+0Itk89kow3LUi8bRhufGK8syGmVDWXyibg5ZF0qYTHf/UpNv9 QXeDChznyBlhYIBggP2xmkJsdso9elqgaOKjMNuYtnbfaiR3j1CzZ8DfMnq28EN8kM44 86KlSndVrDYion4N2pouAr4JfeJ9rBQR85YaFI6QGMOaoC8iDHNTCtDG0eCtnWii71MR d76osmTHfz18CsE8zlptVjC8WQigfH5rwsth+Cks/af5w+k+I4nfKl9cRgDqL2GDoRLs 0DeaEK2VzKvILmt+LZjLmhArJ9ox0IhbNaZHzOEfrBaBb3ByD0S5SJXwwUEArz/6ynNz Mrzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=ecouykwp; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519 header.b=108E4Ct+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k12-20020a17090666cc00b00718cd011cd9si30130729ejp.59.2022.07.08.08.24.06; Fri, 08 Jul 2022 08:24:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=ecouykwp; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519 header.b=108E4Ct+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238261AbiGHOyx (ORCPT + 99 others); Fri, 8 Jul 2022 10:54:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49678 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237623AbiGHOyv (ORCPT ); Fri, 8 Jul 2022 10:54:51 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B9A9D18E13 for ; Fri, 8 Jul 2022 07:54:49 -0700 (PDT) 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 3400C21FE0; Fri, 8 Jul 2022 14:54:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1657292088; 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=l7Aw7CUlH7hnP8Qg6TBNYPcNryVs2jtH5tretlprBAE=; b=ecouykwpcGwwihI2S1zbFptGgJiA2LHezwWP2/VlZH3l/NXsKxjCfE5nXyaW4xJVTiRlmG mb0go9GQLRRhHFp0C7RwF9/GK03quAByTPran4XRBLF15sItKFpC7hC82VZUCb7vsAKOuh LAxTT6QCbC3C3ktulb0h6fm8gWDONWs= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1657292088; 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=l7Aw7CUlH7hnP8Qg6TBNYPcNryVs2jtH5tretlprBAE=; b=108E4Ct+4NeOjPX3bV02xPwutJ+TucYy9lQchqrTiBLy9q2HKhTvn9TqcWEITsO3QLq7xb Ns+Pb93b6kJakcAw== 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 0B45A13A80; Fri, 8 Jul 2022 14:54:48 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id /9DUAThFyGJyZAAAMHmgww (envelope-from ); Fri, 08 Jul 2022 14:54:48 +0000 Message-ID: Date: Fri, 8 Jul 2022 16:54:47 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [PATCH] mm/page_alloc: replace local_lock with normal spinlock -fix -fix Content-Language: en-US To: Mel Gorman , Andrew Morton Cc: Nicolas Saenz Julienne , Marcelo Tosatti , Michal Hocko , Hugh Dickins , Yu Zhao , Marek Szyprowski , LKML , Linux-MM References: <20220708144406.GJ27531@techsingularity.net> From: Vlastimil Babka In-Reply-To: <20220708144406.GJ27531@techsingularity.net> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 7/8/22 16:44, Mel Gorman wrote: > pcpu_spin_unlock and pcpu_spin_unlock_irqrestore both unlock > pcp->lock and then enable preemption. This lacks symmetry against > both the pcpu_spin helpers and differs from how local_unlock_* is > implemented. While this is harmless, it's unnecessary and it's generally > better to unwind locks and preemption state in the reverse order as > they were acquired. Hm I'm confused, it seems it's done in reverse order (which I agree with) before this -fix-fix, but not after it? before, pcpu_spin_lock() (and variants) do pcpu_task_pin() and then spin_lock() (or variant), and pcpu_spin_unlock() does spin_unlock() and then pcpu_task_unpin(). That seems symmetrical, i.e. reverse order to me? And seems to match what local_lock family does too. > This is a fix on top of the mm-unstable patch > mm-page_alloc-replace-local_lock-with-normal-spinlock-fix.patch > > Signed-off-by: Mel Gorman > --- > 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 934d1b5a5449..d0141e51e613 100644 > --- a/mm/page_alloc.c > +++ b/mm/page_alloc.c > @@ -192,14 +192,14 @@ static DEFINE_MUTEX(pcp_batch_high_lock); > > #define pcpu_spin_unlock(member, ptr) \ > ({ \ > - spin_unlock(&ptr->member); \ > pcpu_task_unpin(); \ > + spin_unlock(&ptr->member); \ > }) > > #define pcpu_spin_unlock_irqrestore(member, ptr, flags) \ > ({ \ > - spin_unlock_irqrestore(&ptr->member, flags); \ > pcpu_task_unpin(); \ > + spin_unlock_irqrestore(&ptr->member, flags); \ > }) > > /* struct per_cpu_pages specific helpers. */