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 CF7B1C54EAA for ; Fri, 27 Jan 2023 07:22:33 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 615E78E0001; Fri, 27 Jan 2023 02:22:33 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 5C4DB6B0072; Fri, 27 Jan 2023 02:22:33 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 48DCE8E0001; Fri, 27 Jan 2023 02:22:33 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 37B0D6B0071 for ; Fri, 27 Jan 2023 02:22:33 -0500 (EST) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 0F1DBA017C for ; Fri, 27 Jan 2023 07:22:33 +0000 (UTC) X-FDA: 80399736186.14.153AF59 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf07.hostedemail.com (Postfix) with ESMTP id E05774000F for ; Fri, 27 Jan 2023 07:22:29 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=jJllVMhM; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf07.hostedemail.com: domain of leobras@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=leobras@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1674804149; h=from:from:sender: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:dkim-signature; bh=aCvH1Hw+usSmahc+hlrP0dtOvZeGp+rvKKc6PHdPD30=; b=CVb3WxGQGgm6up6wB1kzYqatUi4ZxWZJK4BQ2eUW3jekksKbWL9IRW7jrXI2/Dk9z5uppq f20FnLOHWp0mmMxiTklDOPavr0b8hVH8GHdQxduSvMi/S9fvryQmuZAgwwUfB/wY5jFXFx WRiWeoRWkf95BYmvfaDK63flmp4yLg8= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=jJllVMhM; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf07.hostedemail.com: domain of leobras@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=leobras@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1674804149; a=rsa-sha256; cv=none; b=Yf16TuPnoetIQN/Qu9ykAGq6WZkoLrEwSDTt45ccAXNekP7GofzPk2WAibVKxdmKl39ZwK tzl8G5UYLncJsrhBZL31RMIDtzXh21izeGsmByaMMIc/yT7ZylUxTmTtiIWbM0PnFQLEsO oxFrjjeMJLOS4YPjtcK3RHhnFwge+g8= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1674804149; 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=aCvH1Hw+usSmahc+hlrP0dtOvZeGp+rvKKc6PHdPD30=; b=jJllVMhMGAdmMvU4qZY909KzWnfk0gSm5Vi41MB1gjhfKIslVYSsiarlFBrefc5jlFDtfO yT57lsG930GDsD9cLO2CRoBZFHqoN3Ib5Y9aUPIlXSjC5uFMPq2W3o2nNXk+MrcZIxliv7 PY3APJRzeKDsQQhAXJsL237SnqDEyVg= Received: from mail-oo1-f69.google.com (mail-oo1-f69.google.com [209.85.161.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-607-u4CW3kAYOBqHdPDUWZksdg-1; Fri, 27 Jan 2023 02:22:27 -0500 X-MC-Unique: u4CW3kAYOBqHdPDUWZksdg-1 Received: by mail-oo1-f69.google.com with SMTP id y19-20020a4a9c13000000b004e3c9193e5eso1362064ooj.11 for ; Thu, 26 Jan 2023 23:22:27 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=78CU6PVXyI3TCut8pJAaTXp7IGKel4v7tbwx9feohu0=; b=AftUi3tX46zO78x7yezzFhO2nfg5/2Lja2zACEgRnH35qsn2U1eHGYuvFuIyb9Dck4 V8WfDYszHmWpa28GsYclVrejqYcZ2L4586KHmotm6EgObfzDRvhXn3X19aomhY/Wmhx/ UmDPqHNVubv89GVpXBlFN8n9pIWuG11Sp/FQO/y0JNV2Lk8yAhBoqQHfGpR5UJaJCHyP d7igV2xqyaVSf4m4lPbHfbdwvTsMBAadkBDXP2EF8GJm6Bpj1B++751d8MMNlg+4KpZ1 oaTejlAPm1LiOmwKkz75HG8LwGx5RWgotjGoSYgaPKmNH6lk1mPIcmWH7dMZaXOIMX5f w45A== X-Gm-Message-State: AO0yUKUBNbif4hfZsd4yNi/Ns+96qh96Yyx6RqZxaBVfCx7CNheWRyjJ DUqbKWFJFiFmVfnRbo5aybJOr8kD6xS/3ljzTfW0Wf2tcPDeqJIgFMbxFG3p+FDdvGuq+TGAivt YmIg0HmaROM0= X-Received: by 2002:a05:6871:69f:b0:15b:9460:f1eb with SMTP id l31-20020a056871069f00b0015b9460f1ebmr2384229oao.37.1674804146922; Thu, 26 Jan 2023 23:22:26 -0800 (PST) X-Google-Smtp-Source: AK7set+CW8pYdHDqWVhmo/6o6hIHH8WuQ4HIEriLSDTIZBz9++MR53gYL25QN5SatPjOVA/58gBFUA== X-Received: by 2002:a05:6871:69f:b0:15b:9460:f1eb with SMTP id l31-20020a056871069f00b0015b9460f1ebmr2384220oao.37.1674804146676; Thu, 26 Jan 2023 23:22:26 -0800 (PST) Received: from ?IPv6:2804:1b3:a800:6912:c477:c73a:cf7c:3a27? ([2804:1b3:a800:6912:c477:c73a:cf7c:3a27]) by smtp.gmail.com with ESMTPSA id a21-20020a056870b15500b0011d02a3fa63sm1467675oal.14.2023.01.26.23.22.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Jan 2023 23:22:26 -0800 (PST) Message-ID: <52a0f1e593b1ec0ca7e417ba37680d65df22de82.camel@redhat.com> Subject: Re: [PATCH v2 0/5] Introduce memcg_stock_pcp remote draining From: Leonardo =?ISO-8859-1?Q?Br=E1s?= To: Michal Hocko , Roman Gushchin Cc: Marcelo Tosatti , Johannes Weiner , Shakeel Butt , Muchun Song , Andrew Morton , cgroups@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Frederic Weisbecker Date: Fri, 27 Jan 2023 04:22:20 -0300 In-Reply-To: References: <20230125073502.743446-1-leobras@redhat.com> <9e61ab53e1419a144f774b95230b789244895424.camel@redhat.com> User-Agent: Evolution 3.46.2 MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: E05774000F X-Stat-Signature: nbiqdjtqoh11ers3ie89m3b59z4fiars X-HE-Tag: 1674804149-333889 X-HE-Meta: U2FsdGVkX1+MH3eHnOFE27RNmMy5R6xFtwNyVl3cqnvEKmZKOYEmGzXYnO+BEsUlLl5g2gG0MxqVaXJCNZFV/lz/p2x7u9T724LoKxZeXWNNmEuJ6MdfL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gv4NXOYtkWZesxR2ukou44mKGJJ5LtjQYIArCfupFT+UbRD9BMMANzGYNd8jtxwmsQZAmovWqLlV6Q33RwEShp49ZofiQZ571FY53Lu1CpjRNSPVa9KsO/fV1/sZfEprZniBc6mAyhtIkJ8JIgowNYcPzMOv7sOZkaeUj6m+6hyJu0RuJuW/FoW4qho1oVEhiNhqGZK5fNhPwbPiGmU51vciOEGpKrmZ5hKd2qpnCG5wolMAlIVb2eaZsyhMOW6CBUa+vQavbudkj+ZMFt6W+Rk14= 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 Fri, 2023-01-27 at 08:11 +0100, Michal Hocko wrote: > [Cc Frederic] >=20 > On Thu 26-01-23 15:12:35, Roman Gushchin wrote: > > On Thu, Jan 26, 2023 at 08:41:34AM +0100, Michal Hocko wrote: > [...] > > > > Essentially each cpu will try to grab the remains of the memory quo= ta > > > > and move it locally. I wonder in such circumstances if we need to d= isable the pcp-caching > > > > on per-cgroup basis. > > >=20 > > > I think it would be more than sufficient to disable pcp charging on a= n > > > isolated cpu. > >=20 > > It might have significant performance consequences. >=20 > Is it really significant? >=20 > > I'd rather opt out of stock draining for isolated cpus: it might slight= ly reduce > > the accuracy of memory limits and slightly increase the memory footprin= t (all > > those dying memcgs...), but the impact will be limited. Actually it is = limited > > by the number of cpus. >=20 > Hmm, OK, I have misunderstood your proposal. Yes, the overal pcp charges > potentially left behind should be small and that shouldn't really be a > concern for memcg oom situations (unless the limit is very small and > workloads on isolated cpus using small hard limits is way beyond my > imagination). >=20 > My first thought was that those charges could be left behind without any > upper bound but in reality sooner or later something should be running > on those cpus and if the memcg is gone the pcp cache would get refilled > and old charges gone. >=20 > So yes, this is actually a better and even simpler solution. All we need > is something like this > diff --git a/mm/memcontrol.c b/mm/memcontrol.c > index ab457f0394ab..13b84bbd70ba 100644 > --- a/mm/memcontrol.c > +++ b/mm/memcontrol.c > @@ -2344,6 +2344,9 @@ static void drain_all_stock(struct mem_cgroup *root= _memcg) > =09=09struct mem_cgroup *memcg; > =09=09bool flush =3D false; > =20 > +=09=09if (cpu_is_isolated(cpu)) > +=09=09=09continue; > + > =09=09rcu_read_lock(); > =09=09memcg =3D stock->cached; > =09=09if (memcg && stock->nr_pages && >=20 > There is no such cpu_is_isolated() AFAICS so we would need a help from > NOHZ and cpuisol people to create one for us. Frederic, would such an > abstraction make any sense from your POV? IIUC, 'if (cpu_is_isolated())' would be instead: if (!housekeeping_cpu(smp_processor_id(), HK_TYPE_DOMAIN) || !housekeeping_cpu(smp_processor_id(), HK_TYPE_WQ)