Received: by 2002:a05:6520:4d:b0:139:a872:a4c9 with SMTP id i13csp3480384lkm; Tue, 21 Sep 2021 17:11:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyJCe9mu9HnRdPeeI/saSoCXNyXooIJ6bLtNQpDonCehF9Kbxnidjz4TpXbBZoUWhB4i6Jv X-Received: by 2002:a17:907:76e7:: with SMTP id kg7mr38673213ejc.344.1632269488579; Tue, 21 Sep 2021 17:11:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632269488; cv=none; d=google.com; s=arc-20160816; b=yxta5bvea0/CYhzPHeYMIASr4Zs3gQ3z64QthuIggwf9bLrRKoBiDc2Q8m514dwpaU LMcKJ0D6a0c63hLu+eK8KRCMaEgMVyfBQhkLwScEWa+R5VQNMrPFEcGiRapdokF2/xVs YlnWT2H+ReRLe/7j9C+4l5OppwwAyfaYCl8ldxbuVTVtxorOGa10YAmFj2UShunhQQFe a80yyQEPSlntWwi3OoBWV4bwc2E561ZXkMKpWuJMP9SC2p+EBPXYb80UjOIQPjRwyxF8 HQ9pIUMk+Q6UtAymz46NoQegdMDp3//uqYzd8O7pyIbQqbwMhvj29clxrj/Z4hd7wSNv fzXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=x/UjHBXWKbw/Bq/O4XA3P2t47w4xKmeiHWunwBQt2FI=; b=N+X0GC/Tx1hvTXNavjpbvCJfdPtJq4Nv6cblmdCc1Or7z4ifWkrrhc7oyaNJcDstft Zk3cneBnLfuvEKprHiDR5zBpiVDkyi3iD3NKS8hAsR60YDyVU0dHq4I9u17/QjtsG4fZ dHCVPIW5y1t4gFRQDF7ecASxaQJaLidrqvqsdeOX3vBevjmGz/PmZXBaR6mkEZ6cfp+r dOEf+cCC+mraQKOMv5TMDweLrWhIgtWxgJmunkpn8NDMKm6Wb82m6Wewaz4TR06ovg+w 8qRwQGvW8Zd5F3OTVzrfPGi16io5Oo8Q9e5SZMUSEQWStRwiijiw/vFov17hc3MjfciV Xllw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=bFWwtBro; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b1si821798ejb.152.2021.09.21.17.10.55; Tue, 21 Sep 2021 17:11:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=bFWwtBro; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235942AbhIUWHc (ORCPT + 99 others); Tue, 21 Sep 2021 18:07:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58120 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232406AbhIUWHY (ORCPT ); Tue, 21 Sep 2021 18:07:24 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E84F9C061574; Tue, 21 Sep 2021 15:05:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=x/UjHBXWKbw/Bq/O4XA3P2t47w4xKmeiHWunwBQt2FI=; b=bFWwtBro5+TnqlxOVXw1Un4YD7 wWIWFF2Di+S+8FjiQRvOB3x/FUpIpwjO84lkVb6kPN5gmfM6yQDwjTsd9Hdnvev4iHO/p+gn1RBz8 CETK/G3cHnFpiEH3NYdv+Oe5xEGrbrmgAKXz/Hzgwo1ScfHUDfeXkRBspMOLHmaYvHrp358KxpCKA oxB9s8gFzSdQr9ewiOUIFTTnqdCCKBYgCBNIx+TQwOut9BzJvuMVI1Fsh1pyxeeGs15H08P/sbIPK kyF+xuwlVp3C7LB4GV7tBh/Y+jkcIpmLoSKw/hrkXMmFZUXOrxgOdJElf/wyyKtw/gAaURW+u1U2V NLiE4o2w==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=worktop.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1mSnrr-004Dui-2C; Tue, 21 Sep 2021 22:04:07 +0000 Received: by worktop.programming.kicks-ass.net (Postfix, from userid 1000) id 2471F981483; Wed, 22 Sep 2021 00:03:58 +0200 (CEST) Date: Wed, 22 Sep 2021 00:03:58 +0200 From: Peter Zijlstra To: Nicolas Saenz Julienne Cc: akpm@linux-foundation.org, frederic@kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, tglx@linutronix.de, cl@linux.com, juri.lelli@redhat.com, mingo@redhat.com, mtosatti@redhat.com, nilal@redhat.com, mgorman@suse.de, ppandit@redhat.com, williams@redhat.com, bigeasy@linutronix.de, anna-maria@linutronix.de, linux-rt-users@vger.kernel.org Subject: Re: [PATCH 2/6] mm/swap: Introduce alternative per-cpu LRU cache locking Message-ID: <20210921220358.GN4323@worktop.programming.kicks-ass.net> References: <20210921161323.607817-1-nsaenzju@redhat.com> <20210921161323.607817-3-nsaenzju@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210921161323.607817-3-nsaenzju@redhat.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 21, 2021 at 06:13:20PM +0200, Nicolas Saenz Julienne wrote: > +static inline void lru_cache_lock(struct lru_cache_locks *locks) > +{ > + if (static_branch_unlikely(&remote_pcpu_cache_access)) { > + /* Avoid migration between this_cpu_ptr() and spin_lock() */ > + migrate_disable(); > + spin_lock(this_cpu_ptr(&locks->spin)); > + } else { > + local_lock(&locks->local); > + } > +} > +static inline void lru_cache_unlock(struct lru_cache_locks *locks) > +{ > + if (static_branch_unlikely(&remote_pcpu_cache_access)) { > + spin_unlock(this_cpu_ptr(&locks->spin)); > + migrate_enable(); > + } else { > + local_unlock(&locks->local); > + } > +} *why* use migrate_disable(), that's horrible!