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 E6C07C433F5 for ; Mon, 21 Feb 2022 14:27:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 629E68D0006; Mon, 21 Feb 2022 09:27:22 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 5D8428D0005; Mon, 21 Feb 2022 09:27:22 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4C7658D0006; Mon, 21 Feb 2022 09:27:22 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0217.hostedemail.com [216.40.44.217]) by kanga.kvack.org (Postfix) with ESMTP id 3E0388D0005 for ; Mon, 21 Feb 2022 09:27:22 -0500 (EST) Received: from smtpin27.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id F12E79F840 for ; Mon, 21 Feb 2022 14:27:21 +0000 (UTC) X-FDA: 79167014682.27.E202DD5 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by imf19.hostedemail.com (Postfix) with ESMTP id 7C2DE1A0007 for ; Mon, 21 Feb 2022 14:27:21 +0000 (UTC) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 3F37E21127; Mon, 21 Feb 2022 14:27:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1645453640; h=from:from:reply-to: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=x7qlynhI6VNEu44qmvL7ARJ1jvjijtZcw+Rs2WqC7BU=; b=cQs2PZLCJnE2+44odjuVX/QVbqM5A9SJqHn/bj8zvDOHajtiXL1KUsXpytN/TTFMh1UVSW QAzf9biM8mwylRViQrjJqU6EIstjeY2LSDu6uFMLtTt6/F9lhgR2Q7ARQgISSsCc4EUvlt Ms4d/g60ij+I1u4EPbKqUX2FwA2z7y8= Received: from suse.cz (unknown [10.100.201.86]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 0F4EEA3B81; Mon, 21 Feb 2022 14:27:20 +0000 (UTC) Date: Mon, 21 Feb 2022 15:27:19 +0100 From: Michal Hocko To: Sebastian Andrzej Siewior Cc: cgroups@vger.kernel.org, linux-mm@kvack.org, Andrew Morton , Johannes Weiner , Michal =?iso-8859-1?Q?Koutn=FD?= , Peter Zijlstra , Thomas Gleixner , Vladimir Davydov , Waiman Long , Roman Gushchin Subject: Re: [PATCH v3 2/5] mm/memcg: Disable threshold event handlers on PREEMPT_RT Message-ID: References: <20220217094802.3644569-1-bigeasy@linutronix.de> <20220217094802.3644569-3-bigeasy@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <20220217094802.3644569-3-bigeasy@linutronix.de> X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 7C2DE1A0007 X-Rspam-User: Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=cQs2PZLC; spf=pass (imf19.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.28 as permitted sender) smtp.mailfrom=mhocko@suse.com; dmarc=pass (policy=quarantine) header.from=suse.com X-Stat-Signature: qe8wcjbtabr7917z5cu7mgmf9qg1ay5e X-HE-Tag: 1645453641-492182 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 Thu 17-02-22 10:47:59, Sebastian Andrzej Siewior wrote: > During the integration of PREEMPT_RT support, the code flow around > memcg_check_events() resulted in `twisted code'. Moving the code around > and avoiding then would then lead to an additional local-irq-save > section within memcg_check_events(). While looking better, it adds a > local-irq-save section to code flow which is usually within an > local-irq-off block on non-PREEMPT_RT configurations. >=20 > The threshold event handler is a deprecated memcg v1 feature. Instead o= f > trying to get it to work under PREEMPT_RT just disable it. There should > be no users on PREEMPT_RT. From that perspective it makes even less > sense to get it to work under PREEMPT_RT while having zero users. >=20 > Make memory.soft_limit_in_bytes and cgroup.event_control return > -EOPNOTSUPP on PREEMPT_RT. Make an empty memcg_check_events() and > memcg_write_event_control() which return only -EOPNOTSUPP on PREEMPT_RT= . > Document that the two knobs are disabled on PREEMPT_RT. >=20 > Suggested-by: Michal Hocko > Suggested-by: Michal Koutn=FD > Signed-off-by: Sebastian Andrzej Siewior > Acked-by: Roman Gushchin > Acked-by: Johannes Weiner Acked-by: Michal Hocko Thanks! > --- > Documentation/admin-guide/cgroup-v1/memory.rst | 2 ++ > mm/memcontrol.c | 14 ++++++++++++-- > 2 files changed, 14 insertions(+), 2 deletions(-) >=20 > diff --git a/Documentation/admin-guide/cgroup-v1/memory.rst b/Documenta= tion/admin-guide/cgroup-v1/memory.rst > index faac50149a222..2cc502a75ef64 100644 > --- a/Documentation/admin-guide/cgroup-v1/memory.rst > +++ b/Documentation/admin-guide/cgroup-v1/memory.rst > @@ -64,6 +64,7 @@ Brief summary of control files. > threads > cgroup.procs show list of processes > cgroup.event_control an interface for event_fd() > + This knob is not available on CONFIG_PREEMPT_RT systems. > memory.usage_in_bytes show current usage for memory > (See 5.5 for details) > memory.memsw.usage_in_bytes show current usage for memory+Swap > @@ -75,6 +76,7 @@ Brief summary of control files. > memory.max_usage_in_bytes show max memory usage recorded > memory.memsw.max_usage_in_bytes show max memory+Swap usage record= ed > memory.soft_limit_in_bytes set/show soft limit of memory usage > + This knob is not available on CONFIG_PREEMPT_RT systems. > memory.stat show various statistics > memory.use_hierarchy set/show hierarchical account enabled > This knob is deprecated and shoul= dn't be > diff --git a/mm/memcontrol.c b/mm/memcontrol.c > index 8ab2dc75e70ec..0b5117ed2ae08 100644 > --- a/mm/memcontrol.c > +++ b/mm/memcontrol.c > @@ -859,6 +859,9 @@ static bool mem_cgroup_event_ratelimit(struct mem_c= group *memcg, > */ > static void memcg_check_events(struct mem_cgroup *memcg, int nid) > { > + if (IS_ENABLED(CONFIG_PREEMPT_RT)) > + return; > + > /* threshold event is triggered in finer grain than soft limit */ > if (unlikely(mem_cgroup_event_ratelimit(memcg, > MEM_CGROUP_TARGET_THRESH))) { > @@ -3731,8 +3734,12 @@ static ssize_t mem_cgroup_write(struct kernfs_op= en_file *of, > } > break; > case RES_SOFT_LIMIT: > - memcg->soft_limit =3D nr_pages; > - ret =3D 0; > + if (IS_ENABLED(CONFIG_PREEMPT_RT)) { > + ret =3D -EOPNOTSUPP; > + } else { > + memcg->soft_limit =3D nr_pages; > + ret =3D 0; > + } > break; > } > return ret ?: nbytes; > @@ -4708,6 +4715,9 @@ static ssize_t memcg_write_event_control(struct k= ernfs_open_file *of, > char *endp; > int ret; > =20 > + if (IS_ENABLED(CONFIG_PREEMPT_RT)) > + return -EOPNOTSUPP; > + > buf =3D strstrip(buf); > =20 > efd =3D simple_strtoul(buf, &endp, 10); > --=20 > 2.34.1 --=20 Michal Hocko SUSE Labs