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 BF059C43334 for ; Tue, 5 Jul 2022 20:55:25 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 477BD6B0071; Tue, 5 Jul 2022 16:55:25 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 427D38E0001; Tue, 5 Jul 2022 16:55:25 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2EF726B0074; Tue, 5 Jul 2022 16:55:25 -0400 (EDT) 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 1C9AC6B0071 for ; Tue, 5 Jul 2022 16:55:25 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay11.hostedemail.com (Postfix) with ESMTP id 01BAF8026F for ; Tue, 5 Jul 2022 20:55:24 +0000 (UTC) X-FDA: 79654251810.18.C596744 Received: from out1.migadu.com (out1.migadu.com [91.121.223.63]) by imf08.hostedemail.com (Postfix) with ESMTP id 8E9C816001F for ; Tue, 5 Jul 2022 20:55:24 +0000 (UTC) Date: Tue, 5 Jul 2022 13:55:17 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1657054523; 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: in-reply-to:in-reply-to:references:references; bh=VhLg0Cla8ai3X3/kkktyXt1O9nP6eFUzBhnC95wXg1g=; b=boaUMGQrEYaa64Ejun5RDXRXFn8PWPBU1pEwrfi8rXGvOFIimvDtjTADvibcbOTMbTMh7C m1tF2o0DFhgshmtR/vEjYI1ipC8YECkYlXg0qma7hbvcvuvC00ejkH4eFLHO+KPFS7yp8i ieZLyzDLzT0sps0jmhOT0b7o4jzy4eU= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Roman Gushchin To: Michal Hocko Cc: Andrew Morton , Yafang Shao , Johannes Weiner , Shakeel Butt , Muchun Song , cgroups@vger.kernel.org, linux-mm@kvack.org, bpf@vger.kernel.org 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: X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: linux.dev ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1657054524; 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=VhLg0Cla8ai3X3/kkktyXt1O9nP6eFUzBhnC95wXg1g=; b=5mLJPz7cuM0ox5vJJHERKn0ET3nSQqNwL2gWgOOw1ALrTNx8zFXREK/5xdeXC14l99q92A yX90bJdct4M8HQ0vNBLom9OtJvFW9td6zDGcS+rw5QbOoNCAHMv7IYK5OI0BUdje2m00n0 WAy7BWOpD0FV90CCgLFCpdBmkSl3KfE= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1657054524; a=rsa-sha256; cv=none; b=KO6iEWmtADJ7ro5Y/xpZraFA8XwLZzTEI8jvTFhjT7Yv74bv38ZGidlBhLOggEgVjErCUS XppcasYBXHpg+mpZHJirihTbRJRNOGdxgScXDWkHEkMpBQSQsQYBCzfuAlfec9Mlz8TeD2 XW1B1gHnvfZFgFspk388wUgm626CDNk= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=boaUMGQr; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf08.hostedemail.com: domain of roman.gushchin@linux.dev designates 91.121.223.63 as permitted sender) smtp.mailfrom=roman.gushchin@linux.dev X-Stat-Signature: unk6r81yzb36nh6umgj6siy1u7d8hpgq X-Rspamd-Queue-Id: 8E9C816001F X-Rspam-User: Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=boaUMGQr; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf08.hostedemail.com: domain of roman.gushchin@linux.dev designates 91.121.223.63 as permitted sender) smtp.mailfrom=roman.gushchin@linux.dev X-Rspamd-Server: rspam10 X-HE-Tag: 1657054524-382012 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 Mon, Jul 04, 2022 at 05:12:54PM +0200, Michal Hocko wrote: > On Fri 01-07-22 20:35:21, 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. > > So I guess this will be a GFP_ATOMIC request failing due to the hard > limit, right? I think it would be easier to understand if the specific > allocation request type was mentioned. It all started from the discussion here: https://www.spinics.net/lists/linux-mm/msg302319.html Please, take a look. > > > 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. So the cgroup can > > significantly exceed the memory.max limit without even triggering > > MEMCG_MAX events. > > More on that in other reply. > > > Fix this by making sure that we never enforce allocations without > > raising a MEMCG_MAX event. > > > > Reported-by: Yafang Shao > > Signed-off-by: Roman Gushchin > > Cc: Johannes Weiner > > Cc: Michal Hocko > > Cc: Shakeel Butt > > Cc: Muchun Song > > Cc: cgroups@vger.kernel.org > > Cc: linux-mm@kvack.org > > Cc: bpf@vger.kernel.org > > The patch makes sense to me though even without the weird charge to a > dead memcg aspect. It is true that a very calm memcg can trigger the > even much later after a GFP_ATOMIC charge (or __GFP_HIGH in general) > fails. Good point! > > Acked-by: Michal Hocko Thanks!