Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp687252pxf; Thu, 8 Apr 2021 10:44:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzP69nSDGjfQTroGN5dZmxoGRTM/QJ9uURNQagO3tpca5ABz1kJqb9PGrUg2ZRyK4Tu5XTB X-Received: by 2002:a05:6402:3587:: with SMTP id y7mr13574329edc.54.1617903846363; Thu, 08 Apr 2021 10:44:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617903846; cv=none; d=google.com; s=arc-20160816; b=01OkOWm3k+CcCvm5cW886/21ZTbQKlV6HlsKB2OhIRb4S+9ULfyi/VWwjv+gTP930B BV0H80AoHJkFRuVPtUEEiSudoCWJNPHKbwzhuvns4JZ2Az+XtzAI4qCWxsW/CoU5KZXo /ZLTlbrNWSo1Q1iaLj5ObwlCsgNK5GOc7W2v4tFUcjqaDnmsenfCEF2gyG89F4Dui84M oZptJGkzoK3YRh/c83nn1bhvxSX8MP/0pNwSRt/7R5Wj7KcjzFf/uCOBC8pDh5DoJYoe Jh3xHN4PxhHkzGhazuk1iORWZbKefR8p6APqWqnt3oadNgyUjvGsrMqsjqqrOwrXEvdD t76Q== 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=4aNrwhP62eaceG/STq+4qGEDMoPLgc7hr1CfCuVItvU=; b=rNjmBjOq5IzCyYuveJdlgz731OQh9X/BJwf9IHF0de8p9b/XoZ9f6+FB3FPPE6lqW4 OLdgYsAQk/Y8MWsdKHiUa4Ll9nZ2tmEClXIZdWjhpwFoAA8HPipWjWpw8HqJInong39X msG9fbGoTY92bd5GrWTk+jHKPJzMvbQQb5MuFZAcTuMp253PmjWG6DwuDnGBJ8scHD7W cbe+FaWHbhUfNe6h22u3zg2U0ZIYSGEDz3UlPFdrh1HYaLnGjxtX3ge0HhLR8IaPRvhC 2AWugIHYZa9P2zoyX7MB4KwPdSU/UmuJMF8BPkfLOIGWVJXWGBsLMAiB9iT5n7BKeIgp d8tQ== ARC-Authentication-Results: i=1; mx.google.com; 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 yy2si12365198ejb.113.2021.04.08.10.43.42; Thu, 08 Apr 2021 10:44:06 -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; 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 S232374AbhDHRm7 (ORCPT + 99 others); Thu, 8 Apr 2021 13:42:59 -0400 Received: from outbound-smtp45.blacknight.com ([46.22.136.57]:36821 "EHLO outbound-smtp45.blacknight.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231676AbhDHRm6 (ORCPT ); Thu, 8 Apr 2021 13:42:58 -0400 Received: from mail.blacknight.com (pemlinmail06.blacknight.ie [81.17.255.152]) by outbound-smtp45.blacknight.com (Postfix) with ESMTPS id 2BC21FA7BF for ; Thu, 8 Apr 2021 18:42:46 +0100 (IST) Received: (qmail 18330 invoked from network); 8 Apr 2021 17:42:45 -0000 Received: from unknown (HELO techsingularity.net) (mgorman@techsingularity.net@[84.203.22.4]) by 81.17.254.9 with ESMTPSA (AES256-SHA encrypted, authenticated); 8 Apr 2021 17:42:45 -0000 Date: Thu, 8 Apr 2021 18:42:44 +0100 From: Mel Gorman To: Peter Zijlstra 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: <20210408174244.GG3697@techsingularity.net> References: <20210407202423.16022-1-mgorman@techsingularity.net> <20210407202423.16022-3-mgorman@techsingularity.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. -- Mel Gorman SUSE Labs