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 00995C433EF for ; Mon, 4 Jul 2022 15:07:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 61D936B0072; Mon, 4 Jul 2022 11:07:34 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5CD326B0073; Mon, 4 Jul 2022 11:07:34 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4BD106B0074; Mon, 4 Jul 2022 11:07:34 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 3E6876B0072 for ; Mon, 4 Jul 2022 11:07:34 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 0AC6035461 for ; Mon, 4 Jul 2022 15:07:34 +0000 (UTC) X-FDA: 79649746428.17.F607FD8 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by imf31.hostedemail.com (Postfix) with ESMTP id 724E120046 for ; Mon, 4 Jul 2022 15:07:33 +0000 (UTC) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 2B7C5223F3; Mon, 4 Jul 2022 15:07:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1656947252; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=MMcU4YZLWa62WL4qNjLSZtdaYqVxLE3tGmHxxRtKj8I=; b=gOoq5r7E88AEp+yuoaei6H/O0LSENbP/CeN7WrhkHFWCCiK93dOpZbNpl2GmwAR+MWv6Wb 6+gjoznSiW0AvV3tSSblMVjCSSr0EM9rX8ij6MGjo2LaHhu31dr+o9YMZ631Jf2Ff6U/g3 HBWQyMHHQc6kbAkoTs+pB6sEoEJt/ao= 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 80B0D2C141; Mon, 4 Jul 2022 15:07:31 +0000 (UTC) Date: Mon, 4 Jul 2022 17:07:30 +0200 From: Michal Hocko To: Roman Gushchin Cc: Shakeel Butt , Andrew Morton , Yafang Shao , Johannes Weiner , Muchun Song , Cgroups , Linux MM , bpf Subject: Re: [PATCH] mm: memcontrol: do not miss MEMCG_MAX events for enforced allocations Message-ID: References: <20220702033521.64630-1-roman.gushchin@linux.dev> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1656947253; a=rsa-sha256; cv=none; b=Tdgt/A4gEgBKSlH5pVDoVTZuEomU9n92pPBm5kk2Xizf3vhWIOLFESp/1ry1lPcah6+PFy NkS4A67SSz8wY9Nxvoy+N1RFFfyKHKKJtvhVMS19gA9UD0g7REZR34cJiF9nb0TUaamNF7 BsCaJGNcjIsmSuySQQmPbhl08ny5A+U= ARC-Authentication-Results: i=1; imf31.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=gOoq5r7E; dmarc=pass (policy=quarantine) header.from=suse.com; spf=pass (imf31.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.28 as permitted sender) smtp.mailfrom=mhocko@suse.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1656947253; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=MMcU4YZLWa62WL4qNjLSZtdaYqVxLE3tGmHxxRtKj8I=; b=5hEbH+pOqo5wSPjkIh3iI/tkCzJRyTegK4GunK2E6AUUnjYM2iDg186g0N8fvibfJ0msGr NoRJa17CUAcQn1mxau4mLgsyDlWpNIExG3s6wXQJYYZWvM73anmN/aWgC/yW7nTv9hthkh aSnXK5LqbASti7OvUBQNkdzwXudN7TU= Authentication-Results: imf31.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=gOoq5r7E; dmarc=pass (policy=quarantine) header.from=suse.com; spf=pass (imf31.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.28 as permitted sender) smtp.mailfrom=mhocko@suse.com X-Rspam-User: X-Stat-Signature: rd8of867ysah48n8ag411bd7kt91rr3m X-Rspamd-Queue-Id: 724E120046 X-Rspamd-Server: rspam04 X-HE-Tag: 1656947253-719473 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 Sat 02-07-22 08:39:14, Roman Gushchin wrote: > On Fri, Jul 01, 2022 at 10:50:40PM -0700, Shakeel Butt wrote: > > On Fri, Jul 1, 2022 at 8:35 PM Roman Gushchin wrote: > > > > > > Yafang Shao reported an issue related to the accounting of bpf > > > memory: if a bpf map is charged indirectly for memory consumed > > > from an interrupt context and allocations are enforced, MEMCG_MAX > > > events are not raised. > > > > > > It's not/less of an issue in a generic case because consequent > > > allocations from a process context will trigger the reclaim and > > > MEMCG_MAX events. However a bpf map can belong to a dying/abandoned > > > memory cgroup, so it might never happen. > > > > The patch looks good but the above sentence is confusing. What might > > never happen? Reclaim or MAX event on dying memcg? > > Direct reclaim and MAX events. I agree it might be not clear without > looking into the code. How about something like this? > > "It's not/less of an issue in a generic case because consequent > allocations from a process context will trigger the direct reclaim > and MEMCG_MAX events will be raised. However a bpf map can belong > to a dying/abandoned memory cgroup, so there will be no allocations > from a process context and no MEMCG_MAX events will be triggered." Could you expand little bit more on the situation? Can those charges to offline memcg happen indefinetely? How can it ever go away then? Also is this something that we actually want to encourage? In other words shouldn't those remote charges be redirected when the target memcg is offline? -- Michal Hocko SUSE Labs