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 03714C433EF for ; Sat, 2 Jul 2022 04:23:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229793AbiGBEXb (ORCPT ); Sat, 2 Jul 2022 00:23:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229538AbiGBEXa (ORCPT ); Sat, 2 Jul 2022 00:23:30 -0400 Received: from out2.migadu.com (out2.migadu.com [IPv6:2001:41d0:2:aacc::]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C8C5D1F2E4 for ; Fri, 1 Jul 2022 21:23:28 -0700 (PDT) Date: Fri, 1 Jul 2022 21:23:19 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1656735807; 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=SzXNs70WHMtboWd+grqVTGNXmGyPHBV+9qhpjinuT/Q=; b=mN5Q7vRy1UUefFFp6lW21PTy22P2fZiejxINM5EGYmMxDGaz2xQU2S9Q0swwk6CnPVQ9en dh64+nloD6q+mdFeCMTdh+u5TesvZlzbgdqcFPsWglix4UcgfHjrrXAMTZzQZmUkmwMxtx hwypus3zirQNrFntcfhD/YAmuWIDp5s= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Roman Gushchin To: Yafang Shao Cc: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin Lau , Song Liu , Yonghong Song , john fastabend , KP Singh , Quentin Monnet , Johannes Weiner , Michal Hocko , Shakeel Butt , songmuchun@bytedance.com, Andrew Morton , Christoph Lameter , penberg@kernel.org, David Rientjes , iamjoonsoo.kim@lge.com, Vlastimil Babka , Linux MM , bpf Subject: Re: [RFC PATCH bpf-next 00/10] bpf, mm: Recharge pages when reuse bpf map Message-ID: References: <20220619155032.32515-1-laoar.shao@gmail.com> 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 Sun, Jun 26, 2022 at 02:25:51PM +0800, Yafang Shao wrote: > > > htab->map.numa_node); > > > And then we'd better introduce an improvement for memcg, > > > + /* > > > + * Should wakeup async memcg reclaim first, > > > + * in case there will be no direct memcg reclaim for a long time. > > > + * We can either introduce async memcg reclaim > > > + * or modify kswapd to reclaim a specific memcg > > > + */ > > > + if (gfp_mask & __GFP_KSWAPD_RECLAIM) > > > + wake_up_async_memcg_reclaim(); > > > if (!gfpflags_allow_blocking(gfp_mask)) > > > goto nomem; > > > > Hm, I see. It might be an issue if there is no global memory pressure, right? > > Let me think what I can do here too. > > > > Right. It is not a good idea to expect a global memory reclaimer to do it. > Thanks for following up with it again. After thinking a bit more, I'm not sure if it's actually a good idea: there might be not much memory to reclaim except the memory consumed by the bpf map itself, so waking kswapd might be useless (and just consume cpu and drain batteries). What we need to do instead is to prevent bpf maps to meaningfully exceed memory.max, which is btw guaranteed by the cgroup API: memory.max is defined as a hard limit in docs. Your recent patch is actually doing this for hash maps, let's fix the rest of the bpf code. Thanks!