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 2A92CC4706C for ; Fri, 12 Jan 2024 21:00:17 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 418476B009E; Fri, 12 Jan 2024 16:00:16 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 3A0FE6B00A0; Fri, 12 Jan 2024 16:00:16 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 21A956B00A1; Fri, 12 Jan 2024 16:00:16 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 0BF066B009E for ; Fri, 12 Jan 2024 16:00:16 -0500 (EST) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id CB4B41A0E57 for ; Fri, 12 Jan 2024 21:00:15 +0000 (UTC) X-FDA: 81671876790.01.6FF07C9 Received: from out-174.mta1.migadu.com (out-174.mta1.migadu.com [95.215.58.174]) by imf08.hostedemail.com (Postfix) with ESMTP id DF63716000D for ; Fri, 12 Jan 2024 21:00:12 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=jCSIAizM; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf08.hostedemail.com: domain of roman.gushchin@linux.dev designates 95.215.58.174 as permitted sender) smtp.mailfrom=roman.gushchin@linux.dev ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1705093213; 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=AB0MhXLRhT3Dw+J97a9ohvojU5mnHzEbf5k0cXw9MEc=; b=jXVD9r2UwnMSGYHNDl3vNLXmS1hPAp1AQR+wLXsKwHrfE0Dy+GXHSd3Him78TK+fFSGbGv BQPnaGF7z7eLMDAEzFtM+5TGLbsvixLkjUlsoTUrq7KnasMHfTv7tzbo8r1gFyrR3T+nXE 2b7LZ4z54oFLX00ytOiijO2mByjdJ6A= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=jCSIAizM; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf08.hostedemail.com: domain of roman.gushchin@linux.dev designates 95.215.58.174 as permitted sender) smtp.mailfrom=roman.gushchin@linux.dev ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1705093213; a=rsa-sha256; cv=none; b=x/sBf6dic2w1WMPKH72MtKye4hy1CapVYIXEVmKfkfuhTA9n7t19GOAvEmMViC8b3+Rpo1 O4wRP3xnTbN6OrqZXafoBhbfhMvXqbRnN2Hb7ZFkzyT6wZgzdAGI+fh59U6+LFuOaQXCjR MPFleeypGlAOsQ+u9UX/mj84FHutv08= Date: Fri, 12 Jan 2024 12:59:53 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1705093210; 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=AB0MhXLRhT3Dw+J97a9ohvojU5mnHzEbf5k0cXw9MEc=; b=jCSIAizMUFXd7/w/grgND+UVmxqA6uuDX+7U0FUaXe3p3HfY6GmGpUXKrUiubSDWFzT2S2 vSTx3JJxWzQksGIYsAEhP3kGxGh2xolezlaVponVMi7mFgseKDkrQ8SG+EUeGQL0KsRVKz 3Uvrxq3gVegobcOFauyvFxHH9/ofRXQ= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Roman Gushchin To: Shakeel Butt Cc: Johannes Weiner , Andrew Morton , Michal Hocko , Muchun Song , Tejun Heo , Dan Schatzberg , cgroups@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm: memcontrol: don't throttle dying tasks on memory.high Message-ID: References: <20240111132902.389862-1-hannes@cmpxchg.org> <20240111192807.GA424308@cmpxchg.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Migadu-Flow: FLOW_OUT X-Rspamd-Queue-Id: DF63716000D X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: cijw17n53itxudmwrosdht7zfbzg8sxz X-HE-Tag: 1705093212-213345 X-HE-Meta: U2FsdGVkX1/Wmi09fAYn9TxaU1GGDmqsl9bRr4YY26R4xObGCdwPDgXEu5PJEKwJFgWhwJyrpg9uuIVa0t1bY4bnhzMOib5O0UrB64wCrdf7Diq0anfY7tXJAEvFBG8qt+3wDGi/Lbohy/DRf9+r+hruHFEOi9ObhcEGBLi7sfJYJfLoi+MiI0iprbJ3gMi+/smjV5Wx9KuClz2XGFrXzwTKY2W5RGIsIm/WCYZgKWhTlW9Ha1Ngjpb3zlq7Odsxdc6JOjlZ0sgSbDIHAERfuuIOaE0IX7a1BCUhZTKgYlyZiJJJLoqBUUNuZ2qz+XlHCYEreLPZO/v46k1jxrRf/eFlJSvC8GV5FooY253Twp5oXTUZyTyeNUK09dRRO2oeTdBH9YHx926Tt0LNfNnxolPuh87x6Z2qlcM35DQYd6KViPB2ElBJ3b7pHXjBLhhbl7omYmGinMBZ2DimFu2YuAL9ELkT4GYp0newkwOC2YxRT2R4e+vaEDq8D5erV+0m9grH4U/4UqaP/CtGa0Pm9xGXwEh6TU1nXgNunhJCneypQxOOEDze3/hBgePkx+cxoU3ZsTfKE4TNNDD19v6eD6/SzrhrAI7rGoiK5m4MUwh8DiAoHeRWbR7cCTzx9bcIBL/WujBAG3BQfQXcy+uqcGXN9OsnMkfxMRV6qM0yXACB5SimiCo4jsOV/bL9pIASeB0rfye/xxd1ZOjbL6ic6pU3S3SHuapg6Jj5CqwyjtUT0fnZam49cSXYQ8Bt05BflNLGSeme1/pQiGIRf/L1yKbBVS53dKBlpyhZJUvRZUfnF5mXaveJz5erAYuesgh0gOLNCeb3AwnzboWnc5cwTJKBNL5ln8kFV1hwmTgN2ZsKzcDgXz7hbvovymjkJ9uycfHrPDF0vN6kTQvOMiJ8VGYcXqi2XkGVPZ9oqzE40FfuV3lZyzU+7Da3M9wQqRuFjAxxIVYNTm90+2mTO9Y TpQaQ1dY v+bBqOEA5lQDaUKyfi6FCtcNI3AeGbYDK50cbJgWQP9f6xqP0Ie16arVh2y4Y4e7xkmyb2qv8y2HrhrdScbq0d3xHjPW0Ty9zfxt7aW9v6/K12P5X/QEJUVv6q/nCMVxeDiG1Our6XNWy8mU5OVcCu+ZLzysFj2iAs+avEM1brqTEkaNUd1cJ8Yn41THXxpUp5dH2jtx9xa20CnJtm6QUmQM7XDNKxR4bpk2f/vw9RA7EPLTCaAfRwO3nfSgwHEr0WGl4Chy4JFyUqOnpjpjw15WZ90oPnvykBgOBz1YjIwBb6luiAP/IPJANLFduo58xOBoV7A4jnzqb4/MJJy8l7jmUyPiBRKXge199 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: List-Subscribe: List-Unsubscribe: On Fri, Jan 12, 2024 at 11:04:06AM -0800, Shakeel Butt wrote: > On Thu, Jan 11, 2024 at 11:28 AM Johannes Weiner wrote: > > > [...] > > > > From 6124a13cb073f5ff06b9c1309505bc937d65d6e5 Mon Sep 17 00:00:00 2001 > > From: Johannes Weiner > > Date: Thu, 11 Jan 2024 07:18:47 -0500 > > Subject: [PATCH] mm: memcontrol: don't throttle dying tasks on memory.high > > > > While investigating hosts with high cgroup memory pressures, Tejun > > found culprit zombie tasks that had were holding on to a lot of > > memory, had SIGKILL pending, but were stuck in memory.high reclaim. > > > > In the past, we used to always force-charge allocations from tasks > > that were exiting in order to accelerate them dying and freeing up > > their rss. This changed for memory.max in a4ebf1b6ca1e ("memcg: > > prohibit unconditional exceeding the limit of dying tasks"); it noted > > that this can cause (userspace inducable) containment failures, so it > > added a mandatory reclaim and OOM kill cycle before forcing charges. > > At the time, memory.high enforcement was handled in the userspace > > return path, which isn't reached by dying tasks, and so memory.high > > was still never enforced by dying tasks. > > > > When c9afe31ec443 ("memcg: synchronously enforce memory.high for large > > overcharges") added synchronous reclaim for memory.high, it added > > unconditional memory.high enforcement for dying tasks as well. The > > callstack shows that this path is where the zombie is stuck in. > > > > We need to accelerate dying tasks getting past memory.high, but we > > cannot do it quite the same way as we do for memory.max: memory.max is > > enforced strictly, and tasks aren't allowed to move past it without > > FIRST reclaiming and OOM killing if necessary. This ensures very small > > levels of excess. With memory.high, though, enforcement happens lazily > > after the charge, and OOM killing is never triggered. A lot of > > concurrent threads could have pushed, or could actively be pushing, > > the cgroup into excess. The dying task will enter reclaim on every > > allocation attempt, with little hope of restoring balance. > > > > To fix this, skip synchronous memory.high enforcement on dying tasks > > altogether again. Update memory.high path documentation while at it. > > > > Fixes: c9afe31ec443 ("memcg: synchronously enforce memory.high for large overcharges") > > Reported-by: Tejun Heo > > Signed-off-by: Johannes Weiner > > Acked-by: Shakeel Butt > > I am wondering if you have seen or suspected a similar issue but for > remote memcg charging. For example pageout on a global reclaim which > has to allocate buffers for some other memcg. You mean dying tasks entering a direct reclaim mode? Or kswapd being stuck in the reclaim path?