From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5C316C433F5 for ; Tue, 15 Feb 2022 08:47:44 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DE48B6B0078; Tue, 15 Feb 2022 03:47:43 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D6D206B007B; Tue, 15 Feb 2022 03:47:43 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C34586B007D; Tue, 15 Feb 2022 03:47:43 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0085.hostedemail.com [216.40.44.85]) by kanga.kvack.org (Postfix) with ESMTP id B05EA6B0078 for ; Tue, 15 Feb 2022 03:47:43 -0500 (EST) Received: from smtpin16.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 742ED8249980 for ; Tue, 15 Feb 2022 08:47:43 +0000 (UTC) X-FDA: 79144386006.16.B5E5234 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf27.hostedemail.com (Postfix) with ESMTP id CF55540005 for ; Tue, 15 Feb 2022 08:47:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1644914862; 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=KaT4IZCrqMmFOXZ2t0oLDlFW1yEOfuUMyWLt9IKI4yJLS66xWEDBEda2qMUW2ERE14We4d m4Adw2tMaYbi/fReIhB16DL5SM1ymA4cIkBEYd7N0E5YKHM8xZ+9AkySA5NEuM7gVH3y9+ TbxSGYwCSm3TNCHdqa1cUUMbcAVBOAs= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-573-958rLNHxNIOqZ1ydX1n7pQ-1; Tue, 15 Feb 2022 03:47:39 -0500 X-MC-Unique: 958rLNHxNIOqZ1ydX1n7pQ-1 Received: by mail-wm1-f69.google.com with SMTP id v185-20020a1cacc2000000b0034906580813so1050425wme.1 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=zjtDcmhi7S5ZRlXb0kvYMKaFFkAarwdtjZ0ZFYOTA3Q2b5kHefmCrkHTdmMSJSnq2Y ZGsXaWdu5k4GCigXyWLF3rljkVOlnN/LNRKnJynTh67wpRVOmSEF2BKAqL+S46cUPECe VmnrPCHdF1c1BmPzZdSr3XXVpiShDjFX0wizAxL8OL/MezVIVjon6tT4lBJXZAlJRi6W CiZXtHcD2T47A1guTISQcuhLaZBJW20NYkCalHu1D0wlDub1zKl+0LIrM9VLkI8h6Tm4 DWJGWd9t4Pg3MxL5f5u5n3lnB8BBg+CWuMoNugzsiUKioeXdHD9D60N1i4Mmi3keHoJR uH6Q== X-Gm-Message-State: AOAM531KSOPf+E26yWp9MANVLtSaU7KZOS4I0EjXGzPWLKS3BhtwgVVq xK1kRgw5On5tsda8RSJ/rD0XYDWdIv23wdg1jRBUBht4EK/hkTEMWG+Tc5PQww9ZNovo3Q3XZPK jJRr63l0eeMg= X-Received: by 2002:a05:600c:220b:b0:37b:ec02:32c4 with SMTP id z11-20020a05600c220b00b0037bec0232c4mr2160354wml.11.1644914857876; Tue, 15 Feb 2022 00:47:37 -0800 (PST) X-Google-Smtp-Source: ABdhPJxQH/cUi47rF7Dz/C2hD5pM34xuVhSFpBfvoq9RjatP0EnS4lddQ+g8Lgo9AlCHPsD4UxJJfQ== 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> User-Agent: Evolution 3.42.3 (3.42.3-1.fc35) MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: CF55540005 X-Rspam-User: Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=KaT4IZCr; spf=none (imf27.hostedemail.com: domain of nsaenzju@redhat.com has no SPF policy when checking 170.10.129.124) smtp.mailfrom=nsaenzju@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-Stat-Signature: pktc8guinh6kz8j3bbyisr1y4pfsggsy X-Rspamd-Server: rspam11 X-HE-Tag: 1644914862-962468 Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Tue, 2022-02-08 at 12:47 -0300, Marcelo Tosatti wrote: > > Changes since RFC: > > - Avoid unnecessary spin_lock_irqsave/restore() in free_pcppages_bul= k() > > - 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 th= ink > > it's justified here, if we can schedule and join works, waiting fo= r > > an RCU grace period is OK. >=20 > https://patchwork.ozlabs.org/project/netdev/patch/1306228052.3026.16.ca= mel@edumazet-laptop/ >=20 > 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 a= dd a comment. > > - Avoid sparse warnings by using rcu_access_pointer() and > > rcu_dereference_protected(). > >=20 > > include/linux/mmzone.h | 22 +++++- > > mm/page_alloc.c | 155 ++++++++++++++++++++++++++-------------= -- > > mm/vmstat.c | 6 +- > > 3 files changed, 120 insertions(+), 63 deletions(-) > >=20 > > 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 > > =20 > > - struct pcplists *lp; > > + /* > > + * As a rule of thumb, any access to struct per_cpu_pages's 'lp' ha= s > > + * 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->l= p' > > + * can only be derefrenced once. See for example: >=20 > Typo. Noted. Thanks! --=20 Nicol=C3=A1s S=C3=A1enz