Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp633926pxf; Thu, 8 Apr 2021 09:48:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzuU80HroQlCsEh11o9ghWTfLqcus0wAmFSLE+ipKaIgcLHqUdjwLjD0MYXvI3h84qi9E18 X-Received: by 2002:aa7:c683:: with SMTP id n3mr1577203edq.214.1617900538024; Thu, 08 Apr 2021 09:48:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617900538; cv=none; d=google.com; s=arc-20160816; b=lMPB/ud2u7RGQAOAW3Q5Qr0w0SgKyEj1DlRP6d4uXp4CArV8NYlJ7Fmi8NodYJDEXL NkMMYJvbwp8m/2AQah1RHXObGyKZa/lDZrNfFhwzATz08XlhiEMoCmwrMX9j8p7HwN7V l1cDN4TFyJpkd/VgdRQf1JuSv1QNYIpGxTmab1lEYVQznRtEtn0tEv90320pPFgBXeRo TAr2jMGc3QUIb7yLHgCwino48uyxKdKrAU0DYHcECrFxgIl/KJ9sTX2NAuqyQkxNjYjN whcj8spOcE3RMsJ05b6S5VFLmF6VEU5XzmMgkVAMNyX7kRejStSA4eKl2LnVso9oQTUx G2NQ== 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=rPSDzrfrowrO77gFeqY3scGy/8/d4rLkbSq9WX5pPKE=; b=Nm6GV6S8TjIG/Hl72T9YtOw4iroubuitJaqL9OdoTFvVwfrsuaQeaIFR7wqdhnvn22 rH1OxIYT1n57A8GW8r7uFcvDWacYfLrtb+e64mMjf/dzOApWndWhbLolDjhVK97hoApn SJwZhiIVdfdhji0NCFZnIIVtnV57v7ZZFNen2SPWavBM0TsGz6EJ7naKOdyqbyfuBA4v l739sPFKKZgfZvVhfHx/lBKRZHQVq1k47V4pO2TQk5ol1aTeGHEFRGnM42e1smzfSsz0 XTT0w1CchqixElkHWZy04EAN1mew6t+yp2w1ed4XeVqeIqpKNnb7FDUQZuXSdc8t0eZP +Ttg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=g4gIFCTj; 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 dk14si2918595edb.280.2021.04.08.09.48.34; Thu, 08 Apr 2021 09:48: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=g4gIFCTj; 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 S232401AbhDHQrZ (ORCPT + 99 others); Thu, 8 Apr 2021 12:47:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232398AbhDHQrY (ORCPT ); Thu, 8 Apr 2021 12:47:24 -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 F2106C061762; Thu, 8 Apr 2021 09:47:12 -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=rPSDzrfrowrO77gFeqY3scGy/8/d4rLkbSq9WX5pPKE=; b=g4gIFCTjZ2YwfqCdI4fvKFNi04 xcM97NxBfimA6tHY047VWTQeGou2dQbOmYz5UE7LdSCgbsrif9fg2jgzjDOUMGK4D6k06/qljK64R HBxd4r9t64Z8cdxQDJFGGrdCMKqgv4WIEnyAumwcOCm34Ssg04ALRNRh0e6PIh67WBBHOvF7pvbHL dw+uBcGs0NJHmEXgfH4rWd3gVM1cjjDA7LAxIXXl3VbeD/rk0gTJhZLSmrkidr++PXidw86MNmiFE N/wWhrlYUq0Ck3Re2OFbzJQOcU1/s+5WA5UtN9rSecP/8hDQ0Y8ftpPOth+lPqy9b950qT4WyWfSc a/GHJ4Nw==; 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 1lUXnx-008g4t-2v; Thu, 08 Apr 2021 16:46:53 +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)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id ECE373001BF; Thu, 8 Apr 2021 18:46:29 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 4ACD52C1E1B6B; Thu, 8 Apr 2021 12:52:07 +0200 (CEST) Date: Thu, 8 Apr 2021 12:52:07 +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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210407202423.16022-3-mgorman@techsingularity.net> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 07, 2021 at 09:24:14PM +0100, Mel Gorman wrote: > There is a lack of clarity of what exactly local_irq_save/local_irq_restore > protects in page_alloc.c . It conflates the protection of per-cpu page > allocation structures with per-cpu vmstat deltas. > > This patch protects the PCP structure using local_lock which for most > configurations is identical to IRQ enabling/disabling. The scope of the > lock is still wider than it should be but this is decreased laster. > diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h > index a4393ac27336..106da8fbc72a 100644 > --- a/include/linux/mmzone.h > +++ b/include/linux/mmzone.h > @@ -337,6 +338,7 @@ enum zone_watermarks { > #define high_wmark_pages(z) (z->_watermark[WMARK_HIGH] + z->watermark_boost) > #define wmark_pages(z, i) (z->_watermark[i] + z->watermark_boost) > > +/* Fields and list protected by pagesets local_lock in page_alloc.c */ > struct per_cpu_pages { > int count; /* number of pages in the list */ > int high; /* high watermark, emptying needed */ > 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?