Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp109497pxb; Tue, 15 Feb 2022 06:32:36 -0800 (PST) X-Google-Smtp-Source: ABdhPJyHPUWElSvVBU4o3dItt1FjNgxofdtfV5DgB4V1ymVxzYc8IoyDjEmgJoCpxoRxjD4DLUpo X-Received: by 2002:a17:907:7756:: with SMTP id kx22mr3181184ejc.703.1644935555747; Tue, 15 Feb 2022 06:32:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644935555; cv=none; d=google.com; s=arc-20160816; b=a8zUcnQDxtDrv4KKZIOTwDU4DPRzwuvyhUIz4CLPWn/SZHz6K3ShCkBdCdAyVzbSqv Rt6LsTk1NO3CU8AQdOwitw98+HzcNdVm5Yrk5VzhifNNNPoe49B/6tkJUkQJrVEWbZE8 BhiIaRjLwDNlvPlxBqJL9EsbGbuAd5Qn9GY5v5S/HzYPfX7rWUOQU4N5svVZXnye7Ptp V+8/oBvnaTMskBirIEFgz0Jh8IOa6BucdQFByK+ZDSWc23sZmhnE51Rbq5YNmxa3QXID 5ArqhqkmeySEjVGdlPOdGCFSdVsJh8EcIeuDv+3ZeKfzlvcvIncHU7JiSc5WYYnJLhN8 1eFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id:dkim-signature; bh=a4UdifMYSS3/zhcng0VskO4a/iClBAxoJzpoK0nsepA=; b=fZ0PryFH7H5fNMkYy+XbEySYuF29eefDhoJFAWFPTo3LbBnScx4s5vNff0Qa/KeXSZ 4vByqIq7ed4gJ7CtS/AZpbyAM+fKfzcjdCRXll42g84HqPOE1CzCls8VTY89vogBEa6v 3OFa/wnL9fgA6fycq/lkN4wyIZp2CYIxbr7Tn/hxbzS4J+VC6SZkjxbtIIUW926Gxojv /5WU/YVW2NDmqM36rQoE7Lsbet6qsJDzw9PRWiYUHPczfhe8/Ztp3pQGowJXCoLgBwxV +0DZKlpA9XCWlXMf6KrFSz1lCZmfGV4FcURQlZn+AY45KoGaks7qqiZUslaLN1Zzqut3 qUcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="F/tHojAW"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p11si3255141edh.537.2022.02.15.06.32.09; Tue, 15 Feb 2022 06:32:35 -0800 (PST) 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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="F/tHojAW"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230218AbiBOIrw (ORCPT + 99 others); Tue, 15 Feb 2022 03:47:52 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:59046 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229884AbiBOIrv (ORCPT ); Tue, 15 Feb 2022 03:47:51 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E880A1133E2 for ; Tue, 15 Feb 2022 00:47:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1644914861; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=a4UdifMYSS3/zhcng0VskO4a/iClBAxoJzpoK0nsepA=; b=F/tHojAW2eEE8PC+9J4U6rcRqlOXjw9PAMOJgoRBbCLltuni6C9Lf0JmJ2tf7F6QTbu4vE zC2MZ8ZpBYIVXwOtiyQ9SKyMHsEAH15AP9EC1aJyGSGqzEli8ND2i3cTti8LLFeRMWRIAT g1UT0CsLjQUoPPExaSUx5Ymt8i6og7k= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-10-11NlNAkQNZmz92VV5Bjngw-1; Tue, 15 Feb 2022 03:47:39 -0500 X-MC-Unique: 11NlNAkQNZmz92VV5Bjngw-1 Received: by mail-wm1-f71.google.com with SMTP id r11-20020a1c440b000000b0037bb51b549aso258837wma.4 for ; Tue, 15 Feb 2022 00:47:38 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=a4UdifMYSS3/zhcng0VskO4a/iClBAxoJzpoK0nsepA=; b=WhtwNryI6YksRh/OgTbBcc3AOsaF+J/AJcTNSGt9gKhQEyrzop1A4gPJiOus9FvgMH JRBDxRbGYVNgrVGGNNxcJUJnsZO3uXGOO9WyS4Va3wuqPemnxNwzhPHrWbzjFXSV3OYg gayfXMheypXqVtoU885ScqzkvMRC2FMFFUiFju8ku6YTkG+tzAZRkObIGnwh89mEPcph L/68IrbfF/0rMHIESrEdVOayeyYZDEsIZJNwAbn1aHzdwL6pKZLj1T6g2Lj8ASZwoWpn awDBI0lgrSFyqHshnrBHS5nGZdRvHBCQvZcU5lngtuxKWPZbzf2RYdPtwGE4ZNXNJhgZ JooA== X-Gm-Message-State: AOAM53095/aLVsDtBqbs1BrlFZALkGtp2AxlL2wBJ9X1Iv5IPtFOwhXd 9XLyAXZuFj//U1bOMpTXPKpIyx6ZWCXrxyoeGWmvqDHEwZFQ7iClAao6qlFNrPZJOsXlCDaEKk1 rwsMe/J/HeXQq5UrH4PuW5Hzi X-Received: by 2002:a05:600c:220b:b0:37b:ec02:32c4 with SMTP id z11-20020a05600c220b00b0037bec0232c4mr2160348wml.11.1644914857874; Tue, 15 Feb 2022 00:47:37 -0800 (PST) X-Received: by 2002:a05:600c:220b:b0:37b:ec02:32c4 with SMTP id z11-20020a05600c220b00b0037bec0232c4mr2160335wml.11.1644914857642; Tue, 15 Feb 2022 00:47:37 -0800 (PST) Received: from ?IPv6:2a0c:5a80:1204:1500:37e7:8150:d9df:36f? ([2a0c:5a80:1204:1500:37e7:8150:d9df:36f]) by smtp.gmail.com with ESMTPSA id p15sm17252917wma.27.2022.02.15.00.47.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Feb 2022 00:47:37 -0800 (PST) Message-ID: <2374bbca7651b671ec934fa5c630cbe3eed3b496.camel@redhat.com> Subject: Re: [PATCH 2/2] mm/page_alloc: Add remote draining support to per-cpu lists From: Nicolas Saenz Julienne To: Marcelo Tosatti Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, frederic@kernel.org, tglx@linutronix.de, mgorman@suse.de, linux-rt-users@vger.kernel.org, vbabka@suse.cz, cl@linux.com, paulmck@kernel.org, willy@infradead.org Date: Tue, 15 Feb 2022 09:47:35 +0100 In-Reply-To: References: <20220208100750.1189808-1-nsaenzju@redhat.com> <20220208100750.1189808-3-nsaenzju@redhat.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.42.3 (3.42.3-1.fc35) MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_NONE,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 Tue, 2022-02-08 at 12:47 -0300, Marcelo Tosatti wrote: > > Changes since RFC: > > - Avoid unnecessary spin_lock_irqsave/restore() in free_pcppages_bulk() > > - Add more detail to commit and code comments. > > - Use synchronize_rcu() instead of synchronize_rcu_expedited(), the RCU > > documentation says to avoid it unless really justified. I don't think > > it's justified here, if we can schedule and join works, waiting for > > an RCU grace period is OK. > > https://patchwork.ozlabs.org/project/netdev/patch/1306228052.3026.16.camel@edumazet-laptop/ > > Adding 100ms to direct reclaim path might be problematic. It will also > slowdown kcompactd (note it'll call drain_all_pages for each zone). I did some measurements on an idle machine, worst case was ~30ms. I agree that might too much for direct reclaim, so I'll switch back to expedited and add a comment. > > - Avoid sparse warnings by using rcu_access_pointer() and > > rcu_dereference_protected(). > > > > include/linux/mmzone.h | 22 +++++- > > mm/page_alloc.c | 155 ++++++++++++++++++++++++++--------------- > > mm/vmstat.c | 6 +- > > 3 files changed, 120 insertions(+), 63 deletions(-) > > > > diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h > > index b4cb85d9c6e8..b0b593fd8e48 100644 > > --- a/include/linux/mmzone.h > > +++ b/include/linux/mmzone.h > > @@ -388,13 +388,31 @@ struct per_cpu_pages { > > short expire; /* When 0, remote pagesets are drained */ > > #endif > > > > - struct pcplists *lp; > > + /* > > + * As a rule of thumb, any access to struct per_cpu_pages's 'lp' has > > + * happen with the pagesets local_lock held and using > > + * rcu_dereference_check(). If there is a need to modify both > > + * 'lp->count' and 'lp->lists' in the same critical section 'pcp->lp' > > + * can only be derefrenced once. See for example: > > Typo. Noted. Thanks! -- Nicolás Sáenz