From patchwork Mon Feb 21 18:25:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Andrzej Siewior X-Patchwork-Id: 12754039 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 77148C433F5 for ; Mon, 21 Feb 2022 18:26:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 00BA08D0002; Mon, 21 Feb 2022 13:26:11 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id B838A8D0001; Mon, 21 Feb 2022 13:26:10 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 84DDC8D0007; Mon, 21 Feb 2022 13:26:10 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0053.hostedemail.com [216.40.44.53]) by kanga.kvack.org (Postfix) with ESMTP id 46D268D0003 for ; Mon, 21 Feb 2022 13:26:10 -0500 (EST) Received: from smtpin23.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id D8636180ED7B9 for ; Mon, 21 Feb 2022 18:26:09 +0000 (UTC) X-FDA: 79167616458.23.2603C56 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by imf16.hostedemail.com (Postfix) with ESMTP id 3D99B180008 for ; Mon, 21 Feb 2022 18:26:09 +0000 (UTC) From: Sebastian Andrzej Siewior DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1645467966; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=Jxyd7UXPX5m/2j0TbW7YsD0CbLlXnk2SQHCfRxdbRq8=; b=rDqhHBZwWPmrML+3zs+6Mry2+GNEjjA2OB1vXBk6cIwkdYf79tuoYcBtWuGqMUx7pbqKav A/11ZQzjIQf7TZ0fZ5Qt12GUJbJ4CEf0+OKdcxPBoWpMPvM9G1p2FbpsPgZXRDx3VXeRRU Uq/iEdP/UHrQ4l7y4x65LjBJPhypR3DE+anLYbBxZcQ5HxHzmkG0w0CnJyPiXPQd9VZWk5 qc7JN+OWjdgOUJr695dH+ENcatXmRCfewsDIjstt8Wt34dqGa81x8iLqUMRq9V8MC01d83 u/Aj13T3DL3oGVIK9y6vegva0eyCsY+bK5ZhkIpTAXSC2wNc6xXWBiEdhpDDIQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1645467966; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=Jxyd7UXPX5m/2j0TbW7YsD0CbLlXnk2SQHCfRxdbRq8=; b=z0wkmCZRL38ez2aF9RpPLjXxM5m6UAa833zd33BcQNifDcHjsIBWZcqD8bdsNL9+6VRwmU LpFHPO8HL8JCCEBw== To: cgroups@vger.kernel.org, linux-mm@kvack.org Cc: Andrew Morton , Johannes Weiner , Michal Hocko , =?utf-8?q?Michal_Koutn=C3=BD?= , Peter Zijlstra , Thomas Gleixner , Vladimir Davydov , Waiman Long Subject: [PATCH v4 0/6] mm/memcg: Address PREEMPT_RT problems instead of disabling it. Date: Mon, 21 Feb 2022 19:25:34 +0100 Message-Id: <20220221182540.380526-1-bigeasy@linutronix.de> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 3D99B180008 X-Stat-Signature: 1nnkdsnpwrb98178jme4ioji9kkspewu Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=linutronix.de header.s=2020 header.b=rDqhHBZw; dkim=pass header.d=linutronix.de header.s=2020e header.b=z0wkmCZR; spf=pass (imf16.hostedemail.com: domain of bigeasy@linutronix.de designates 193.142.43.55 as permitted sender) smtp.mailfrom=bigeasy@linutronix.de; dmarc=pass (policy=none) header.from=linutronix.de X-HE-Tag: 1645467969-543601 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: Hi, this series aims to address the memcg related problem on PREEMPT_RT. I tested them on CONFIG_PREEMPT and CONFIG_PREEMPT_RT with the tools/testing/selftests/cgroup/* tests and I haven't observed any regressions (other than the lockdep report that is already there). Changes since v3: - Added __memcg_stats_lock() to __mod_memcg_lruvec_state(). This one does not check for disabled interrupts on !RT. The only user (__mod_memcg_lruvec_state()) checks if the context is task (neither soft nor hard irq) if the two idx are used which are used by rmap.c and otherwise it checks for disabled interrupts. Reported by Shakeel Butt. - In drain_all_stock() migration is disabled and drain_local_stock() is invoked directly if the request CPU is the local CPU. v3: https://lore.kernel.org/all/20220217094802.3644569-1-bigeasy@linutronix.de/ Changes since v2: - rebased on top of v5.17-rc4-mmots-2022-02-15-20-39. - Added memcg_stats_lock() in 3/5 so it a little more obvious and hopefully easiert to maintain. - Opencoded obj_cgroup_uncharge_pages() in drain_obj_stock(). The __locked suffix was confusing. v2: https://lore.kernel.org/all/20220211223537.2175879-1-bigeasy@linutronix.de/ Changes since v1: - Made a full patch from Michal Hocko's diff to disable the from-IRQ vs from-task optimisation - Disabling threshold event handlers is using now IS_ENABLED(PREEMPT_RT) instead of #ifdef. The outcome is the same but there is no need to shuffle the code around. v1: https://lore.kernel.org/all/20220125164337.2071854-1-bigeasy@linutronix.de/ Changes since the RFC: - cgroup.event_control / memory.soft_limit_in_bytes is disabled on PREEMPT_RT. It is a deprecated v1 feature. Fixing the signal path is not worth it. - The updates to per-CPU counters are usually synchronised by disabling interrupts. There are a few spots where assumption about disabled interrupts are not true on PREEMPT_RT and therefore preemption is disabled. This is okay since the counter are never written from in_irq() context. RFC: https://lore.kernel.org/all/20211222114111.2206248-1-bigeasy@linutronix.de/ Sebastian