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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BDE6EC43334 for ; Fri, 8 Jul 2022 03:19:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237062AbiGHDTE (ORCPT ); Thu, 7 Jul 2022 23:19:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53310 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237059AbiGHDTE (ORCPT ); Thu, 7 Jul 2022 23:19:04 -0400 Received: from out2.migadu.com (out2.migadu.com [IPv6:2001:41d0:2:aacc::]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3785D747AD; Thu, 7 Jul 2022 20:19:00 -0700 (PDT) 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 Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org 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!