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 0AA2EC433EF for ; Mon, 4 Jul 2022 15:30:31 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 206596B0072; Mon, 4 Jul 2022 11:30:31 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1B5B96B0073; Mon, 4 Jul 2022 11:30:31 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0A5006B0074; Mon, 4 Jul 2022 11:30:31 -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 EF4E26B0072 for ; Mon, 4 Jul 2022 11:30:30 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id B3395351C8 for ; Mon, 4 Jul 2022 15:30:30 +0000 (UTC) X-FDA: 79649804220.23.73EAE5B Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by imf13.hostedemail.com (Postfix) with ESMTP id 833EB2005B for ; Mon, 4 Jul 2022 15:30:28 +0000 (UTC) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 0169E2277B; Mon, 4 Jul 2022 15:30:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1656948627; 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=xk1ZJHt34COGC3XZeX8tbvvR/9JIJI9lBw/zzga5fSI=; b=f+AtvND0b4DcCf1ZJTPx9fh7p+06SMADxTw+PpX8t9fPp2q3CNp9yeELUPQxtbfQlpFHvN bYZofWkx9tcbzLG+z3RN0jQlWt8y8rAB89NjJBtn0VsDjWOi1AhLCTEdE/JCqBdqrgAdOn 1HNrkuKTAEV67s2/juGSbWMGvc/B84c= 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 6D8302C142; Mon, 4 Jul 2022 15:30:26 +0000 (UTC) Date: Mon, 4 Jul 2022 17:30:25 +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=1656948628; a=rsa-sha256; cv=none; b=5Am49OfMOt/zirjfpvyC0Vi2mm7FY1Q4ktRZvNygtBEtTbTNmW1xP0CqLwYZAjcEwVUDI1 CFZTJaBKQxFTPrrj3qUqlTDJyXYb/v77zEnlLXqpE+bme2WULcyUIU2aauwM0yDdpozmsH qGIwQXcUxCDi2G4DM6oySW9C7eVQVwg= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=f+AtvND0; dmarc=pass (policy=quarantine) header.from=suse.com; spf=pass (imf13.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=1656948628; 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=xk1ZJHt34COGC3XZeX8tbvvR/9JIJI9lBw/zzga5fSI=; b=6rpnz9SdgiGsP2KunRMPHEyRKAiDXVCXtiHB1iGWR1061U1DKtAVydhsY6TQsdj6ldpY7D M6xXBnKacDcpGqOj5Wu3qCYXGLDEkUjcOcJe+5Ox/m92P68wPmLknDbPcuZlLele97NlVZ s4//JNfjY328Yf7IEXorMfc5ksG7jrg= Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=f+AtvND0; dmarc=pass (policy=quarantine) header.from=suse.com; spf=pass (imf13.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: 53sbq4a8nmpkz8a83s6immq5zjow4711 X-Rspamd-Queue-Id: 833EB2005B X-Rspamd-Server: rspam04 X-HE-Tag: 1656948628-428407 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 04-07-22 17:07:32, Michal Hocko wrote: > 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? One more question. Mostly out of curiosity. How is userspace actually acting on those events? Are watchers still active on those dead memcgs? -- Michal Hocko SUSE Labs