Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp3641658iog; Tue, 21 Jun 2022 03:00:52 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sQWuC+5kMkKHumvQHQ4uZjRhqkvE69019oj8i5izYcWsqAnb2LiOAici1WaI6KI9hvroPU X-Received: by 2002:a17:907:9715:b0:711:ca06:ca50 with SMTP id jg21-20020a170907971500b00711ca06ca50mr24480345ejc.192.1655805652015; Tue, 21 Jun 2022 03:00:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655805652; cv=none; d=google.com; s=arc-20160816; b=KccPUUig8o5/SEoRPieptpdGR8XumVRRiyxo5VldUtePRZ+u4z9ibzUs/U3Ij3yFxL dSpz+6YRdQLimYtk5lIh/mwY/6b7j9BjEyt3TLcoDiPTSaaMOAYNRQneFfBAYKgD62Dg B7sDLEnvjOhOSuAXWTGu9hsGcDlYY8ucFPt2nCrUd0rxQXBwtUBDv+vs3FQSyQLutxtH YwKwA5DH42bk8x4RcbJkzyvn/7VkX2Se3oDzhyxhYSOiQqJHLdmo1SV0mhJHeir0nswb qAW0X7TnwhwkcB4od3+gMMDFhSSE4dKuHL3/7aWhv6MpeBYgJiNLGYUZq4qRSpcs1bzu aqfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=Qcky35vP6dVBmoFUBFfGdba8GLZYtmXNyMHWIWpZyTo=; b=dzoDqweXe8r0rO9nxIfL74To8XLSZJMJRweaedX9oQxI9H+XgUMpjKrRJ+AyTFEtJk 5DdiOv/W/nDhVW6q/mFQJ1Y3F1fBE4CxPNP6qUEyYPvzMOopspP+b02jUntNSYM8y1Bo PrZrEeIsvr6KyWzK9dP46ufTcS289d7Hev2ZgDFTakDh9HopjVyQXLN+ixjuIfRyftvt eVUEOeAEVHf9nk8/2CWQOt0e4imKhKK39XY56XBuqxP7aeGLkfavnAL0VpRaPDHojoZ3 0dNiyD1yZvhSY+rw4ZgBaYD4Hl58Bjsm6+b28tRYyDePQcy16BwZNXANMV3zs6NCRElu T5wA== ARC-Authentication-Results: i=1; mx.google.com; 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 p25-20020a056402075900b004356dc9415dsi9750438edy.75.2022.06.21.03.00.24; Tue, 21 Jun 2022 03:00:52 -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; 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 S1348533AbiFUJ3y (ORCPT + 99 others); Tue, 21 Jun 2022 05:29:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42160 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348739AbiFUJ3x (ORCPT ); Tue, 21 Jun 2022 05:29:53 -0400 Received: from outbound-smtp40.blacknight.com (outbound-smtp40.blacknight.com [46.22.139.223]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 18BF4DBF for ; Tue, 21 Jun 2022 02:29:53 -0700 (PDT) Received: from mail.blacknight.com (pemlinmail04.blacknight.ie [81.17.254.17]) by outbound-smtp40.blacknight.com (Postfix) with ESMTPS id 9E49A1C466F for ; Tue, 21 Jun 2022 10:29:51 +0100 (IST) Received: (qmail 21487 invoked from network); 21 Jun 2022 09:29:51 -0000 Received: from unknown (HELO techsingularity.net) (mgorman@techsingularity.net@[84.203.198.246]) by 81.17.254.9 with ESMTPSA (AES256-SHA encrypted, authenticated); 21 Jun 2022 09:29:51 -0000 Date: Tue, 21 Jun 2022 10:29:50 +0100 From: Mel Gorman To: Nicolas Saenz Julienne Cc: Andrew Morton , Marcelo Tosatti , Vlastimil Babka , Michal Hocko , Hugh Dickins , LKML , Linux-MM Subject: Re: [PATCH 7/7] mm/page_alloc: Replace local_lock with normal spinlock Message-ID: <20220621092950.GF15453@techsingularity.net> References: <20220613125622.18628-1-mgorman@techsingularity.net> <20220613125622.18628-8-mgorman@techsingularity.net> <04709b2d0dc702c9bf50f57cde125b07cdf54363.camel@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: <04709b2d0dc702c9bf50f57cde125b07cdf54363.camel@redhat.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,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 Fri, Jun 17, 2022 at 11:39:03AM +0200, Nicolas Saenz Julienne wrote: > Hi Mel, > > On Mon, 2022-06-13 at 13:56 +0100, Mel Gorman wrote: > > @@ -3446,12 +3490,16 @@ void free_unref_page(struct page *page, unsigned int order) > > migratetype = MIGRATE_MOVABLE; > > } > > > > - local_lock_irqsave(&pagesets.lock, flags); > > - freed_pcp = free_unref_page_commit(page, migratetype, order, false); > > - local_unlock_irqrestore(&pagesets.lock, flags); > > - > > - if (unlikely(!freed_pcp)) > > + zone = page_zone(page); > > + pcp_trylock_prepare(UP_flags); > > Now that you're calling the *_irqsave() family of function you can drop > pcp_trylock_prepare/finish() > > For the record in UP: > > #define spin_trylock_irqsave(lock, flags) \ > ({ \ > local_irq_save(flags); \ > 1; > }) > The missing patch that is deferred for a later release uses spin_trylock so unless that is never merged because there is an unfixable flaw in it, I'd prefer to leave the preparation in place. > > + pcp = pcpu_spin_trylock_irqsave(struct per_cpu_pages, lock, zone->per_cpu_pageset, flags); > > + if (pcp) { > > + free_unref_page_commit(pcp, zone, page, migratetype, order); > > + pcp_spin_unlock_irqrestore(pcp, flags); > > + } else { > > free_one_page(page_zone(page), page, pfn, order, migratetype, FPI_NONE); > > + } > > + pcp_trylock_finish(UP_flags); > > } > > > > /* > > As Vlastimil mentioned elsewhere, I also wonder if it makes sense to just > bypass patch #5. Especially as its intent isn't true anymore: > > "As preparation for dealing with both of those problems, protect the lists > with a spinlock. The IRQ-unsafe version of the lock is used because IRQs > are already disabled by local_lock_irqsave. spin_trylock is used in > preparation for a time when local_lock could be used instead of > lock_lock_irqsave." > It's still true, the patch just isn't included as I wanted them to be separated by time so a bisection that points to it is "obvious" instead of pointing at the whole series as being a potential problem. -- Mel Gorman SUSE Labs