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 6C3FBC43334 for ; Fri, 8 Jul 2022 03:19:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AA124900002; Thu, 7 Jul 2022 23:19:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A297F6B0073; Thu, 7 Jul 2022 23:19:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8EF70900002; Thu, 7 Jul 2022 23:19:01 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 7C2556B0071 for ; Thu, 7 Jul 2022 23:19:01 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 1FD3A20BEB for ; Fri, 8 Jul 2022 03:19:01 +0000 (UTC) X-FDA: 79662476082.16.56DB881 Received: from out2.migadu.com (out2.migadu.com [188.165.223.204]) by imf08.hostedemail.com (Postfix) with ESMTP id 70A38160011 for ; Fri, 8 Jul 2022 03:19:00 +0000 (UTC) Date: Thu, 7 Jul 2022 20:18:52 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1657250338; 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=ZzXf77ZnSEJIjuevx+EB4GpaxQjdHtz9/POLfph/nBE=; b=Qy4O0B3TXJnXaPohoJlWl3VViPm/HiAjQYjCu92SV5MLaTSvFAV+asc6HCYkyU8p29uqsK PkUyYZY6tI8B3J1zEbsMAdtKcYG8wSnd5IjAKW9MMeB6HBjelCfaH6lEOd/IoUOOQGqtdu qmer4OS87yqwZODPooty6DN/RPX+W9E= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Roman Gushchin To: Alexei Starovoitov Cc: Yafang Shao , Michal Hocko , Shakeel Butt , Andrew Morton , 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: X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: linux.dev ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=Qy4O0B3T; spf=pass (imf08.hostedemail.com: domain of roman.gushchin@linux.dev designates 188.165.223.204 as permitted sender) smtp.mailfrom=roman.gushchin@linux.dev; dmarc=pass (policy=none) header.from=linux.dev ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1657250340; 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=ZzXf77ZnSEJIjuevx+EB4GpaxQjdHtz9/POLfph/nBE=; b=5Lx6bF1YBdhjtv5E0Vnp1ouPzS1vzJMpKUxRHRZ8LKbEbDhdlJSAvB1P4j5FHn6OPRWL46 HvxOchk/KnAOGI4kwZy2OyqUsG3Qpihg/gXDnvasvTo+pp5EvFinA8JdVF3VzgGXlX3dtp lCKT/HrEfYJpB7IJKt6xmEGSTlNZmSw= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1657250340; a=rsa-sha256; cv=none; b=044To5rLMEyus6AZi6qrXjvUuf94PA1OOI/x4A7Sp+f9pdza9ylL95SvCCfw/1TXS/VN3f 4zsfMVSLeQkNdZ+rAJt0ZrSIfxpbtVWcGDS8pvyTqondDh5uG5v3/AHbi/TujIrWoB4JJ0 ENupaMvVrPbthpBwxeXEZjB30Xv6QAQ= X-Rspam-User: X-Stat-Signature: pca98ahh6qhysab8xuym3odxk1w481zb X-Rspamd-Queue-Id: 70A38160011 Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=Qy4O0B3T; spf=pass (imf08.hostedemail.com: domain of roman.gushchin@linux.dev designates 188.165.223.204 as permitted sender) smtp.mailfrom=roman.gushchin@linux.dev; dmarc=pass (policy=none) header.from=linux.dev X-Rspamd-Server: rspam11 X-HE-Tag: 1657250340-798323 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 Thu, Jul 07, 2022 at 03:41:11PM -0700, Alexei Starovoitov wrote: > On Tue, Jul 5, 2022 at 9:24 PM Roman Gushchin wrote: > > > > Anyway, here is the patch for reparenting bpf maps: > > https://github.com/rgushchin/linux/commit/f57df8bb35770507a4624fe52216b6c14f39c50c > > > > I gonna post it to bpf@ after some testing. > > Please do. It looks good. > It needs #ifdef CONFIG_MEMCG_KMEM > because get_obj_cgroup_from_current() is undefined otherwise. > Ideally just adding a static inline to a .h ? Actually all call sites are already under CONFIG_MEMCG_KMEM. > > and > if (map->objcg) > memcg = get_mem_cgroup_from_objcg(map->objcg); > > or !NULL check inside get_mem_cgroup_from_objcg() > which would be better. Yes, you're right, as now we need to handle it specially. In the near future it won't be necessary. There are patches in mm-unstable which make objcg API useful outside of CONFIG_MEMCG_KMEM. In particular it means that objcg will be created for the root_mem_cgroup. So map->objcg can always point at a valid objcg and we will be able to drop this check. Will post an updated version shortly. Thanks!