From mboxrd@z Thu Jan 1 00:00:00 1970 From: Roman Gushchin Subject: Re: [PATCH] mm: memcontrol: do not miss MEMCG_MAX events for enforced allocations Date: Thu, 7 Jul 2022 20:18:52 -0700 Message-ID: References: <20220702033521.64630-1-roman.gushchin@linux.dev> Mime-Version: 1.0 Return-path: 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= Content-Disposition: inline In-Reply-To: List-ID: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Alexei Starovoitov Cc: Yafang Shao , Michal Hocko , Shakeel Butt , Andrew Morton , Johannes Weiner , Muchun Song , Cgroups , Linux MM , bpf 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!