Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1114693pxf; Thu, 8 Apr 2021 23:44:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxNW+S4N6aB/VggdZUUrZXM4JNX68VzuxQisNOISuNKD8Q1910VQSfI7eHRiw42JDVWkysp X-Received: by 2002:a17:902:bc4c:b029:e9:175e:3367 with SMTP id t12-20020a170902bc4cb02900e9175e3367mr11686153plz.7.1617950698356; Thu, 08 Apr 2021 23:44:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617950698; cv=none; d=google.com; s=arc-20160816; b=p3vgCaLa+3KBmwvELrXFp2pkTUx5/xRC1LH+Z9Z7IA/fFD658XQ5uvUwT3DAun0wkI 3E1W2b6gxth5TTNb1dFE6ahm9uBAtTPsLYjrnNIbGuvAeRzRo9mt6H5oaK4FiBR3SrgB oa84ZPeYDyi8n3MJHclPJQ9chf6DXPQIEO8p+FrovaN0FKFY8RJiYqwKVWAtvffTza4Y JZS5pEzdRhpoiHa2D3fK6F15/MooZumPPbFjHjBF2Vskg+chzsSGXe7WoXHbsYyKygus Cpmt6I85F53ZjJ8goa33uU6CsBPQzXKrlATkHtVLECEnEPjwLHiYjFQ6/BbOsLub3iP8 ig3A== 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=lNcDyfnAaDVyz40OLs8W9SQUkBFyn/zS9u4y9qrOz48=; b=LPbYTNGb+4BJtE45Yd9HboARtLrsPCC2wHf/OCjC3M/m/ZTcLQKHm++DS49RmXMDTE ZSDZey/8XygbJwZqUylZUUxN2b24AYY11Nj5FC4PYlElaNrLDG9xgJG5yRtxwsOuXRPl jfgSNWfzeen9ZVS4+ZTb4tnHMRDnwXKEDKWqzMAl+GdSUsNK0KGSwSanwImoH0uyiqtJ XM7DqW8xL9PG+txoOIa9n34+2JmoMIK8PLLvzFpgHZlifdrqrLlASVDGJ773jnSLtgvr sY32ddSQ9XCrwT23LTjYYcra/c4IfkjnoNpwToO+Ub0Lhjf35Wrzk6hQmJii+Jih+IBm 0XQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=LxMeQ6k8; 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 c15si200219pjv.63.2021.04.08.23.44.46; Thu, 08 Apr 2021 23:44:58 -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=desiato.20200630 header.b=LxMeQ6k8; 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 S233436AbhDIGoU (ORCPT + 99 others); Fri, 9 Apr 2021 02:44:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38758 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233332AbhDIGoS (ORCPT ); Fri, 9 Apr 2021 02:44:18 -0400 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B1DFFC061760; Thu, 8 Apr 2021 23:44:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; 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=lNcDyfnAaDVyz40OLs8W9SQUkBFyn/zS9u4y9qrOz48=; b=LxMeQ6k8WthDPtYXuu4E0irPGY 7Ar8Y4AF86u8heDiFDTN1+VMvsAi4j/qT/SU7BXXCIAn3qzzZasBvuMVGajAUrVoWxHKxjMMfjYht +6pnLIZeRofrEJmEDuTgDk3kIAOZK/S8EXfk4j1ZnNUzgsfy5BT4/RPwNoGho9hSEn7DKvMO/aUZB 9T/a0YGP1hyTP709qleUG/EiV3sk3DUbxjli95g1G6DCCRPG9l/K1xeJXItxIODHBqAxxeqJYk6DO OH+6U8EBEllUbAfpLmKdjb+DRu3gLwzGda35IEcqaH3WgjZ5eohbqicuA2iMPPWUnJ1XsamyfP/Co LGthylxA==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.94 #2 (Red Hat Linux)) id 1lUkny-00AJTb-NC; Fri, 09 Apr 2021 06:40:12 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 47FAB30001B; Fri, 9 Apr 2021 08:39:45 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 3A51F20C8BCEB; Fri, 9 Apr 2021 08:39:45 +0200 (CEST) Date: Fri, 9 Apr 2021 08:39:45 +0200 From: Peter Zijlstra To: Mel Gorman Cc: Linux-MM , Linux-RT-Users , LKML , Chuck Lever , Jesper Dangaard Brouer , Matthew Wilcox , Thomas Gleixner , Ingo Molnar , Michal Hocko , Oscar Salvador Subject: Re: [PATCH 02/11] mm/page_alloc: Convert per-cpu list protection to local_lock Message-ID: References: <20210407202423.16022-1-mgorman@techsingularity.net> <20210407202423.16022-3-mgorman@techsingularity.net> <20210408174244.GG3697@techsingularity.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210408174244.GG3697@techsingularity.net> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 08, 2021 at 06:42:44PM +0100, Mel Gorman wrote: > On Thu, Apr 08, 2021 at 12:52:07PM +0200, Peter Zijlstra wrote: > > > diff --git a/mm/page_alloc.c b/mm/page_alloc.c > > > index a68bacddcae0..e9e60d1a85d4 100644 > > > --- a/mm/page_alloc.c > > > +++ b/mm/page_alloc.c > > > @@ -112,6 +112,13 @@ typedef int __bitwise fpi_t; > > > static DEFINE_MUTEX(pcp_batch_high_lock); > > > #define MIN_PERCPU_PAGELIST_FRACTION (8) > > > > > > +struct pagesets { > > > + local_lock_t lock; > > > +}; > > > +static DEFINE_PER_CPU(struct pagesets, pagesets) = { > > > + .lock = INIT_LOCAL_LOCK(lock), > > > +}; > > > > So why isn't the local_lock_t in struct per_cpu_pages ? That seems to be > > the actual object that is protected by it and is already per-cpu. > > > > Is that because you want to avoid the duplication across zones? Is that > > worth the effort? > > When I wrote the patch, the problem was that zone_pcp_reset freed the > per_cpu_pages structure and it was "protected" by local_irq_save(). If > that was converted to local_lock_irq then the structure containing the > lock is freed before it is released which is obviously bad. > > Much later when trying to make the allocator RT-safe in general, I realised > that locking was broken and fixed it in patch 3 of this series. With that, > the local_lock could potentially be embedded within per_cpu_pages safely > at the end of this series. Fair enough; I was just wondering why the obvious solution wasn't chosen and neither changelog nor comment explain, so I had to ask :-)