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 B25E8C43334 for ; Wed, 13 Jul 2022 02:12:49 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4C0A39400F3; Tue, 12 Jul 2022 22:12:49 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4706E9400E5; Tue, 12 Jul 2022 22:12:49 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 35F3B9400F3; Tue, 12 Jul 2022 22:12:49 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 23E409400E5 for ; Tue, 12 Jul 2022 22:12:49 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay12.hostedemail.com (Postfix) with ESMTP id E8A4A12082D for ; Wed, 13 Jul 2022 02:12:48 +0000 (UTC) X-FDA: 79680453216.09.9EC4F61 Received: from out2.migadu.com (out2.migadu.com [188.165.223.204]) by imf21.hostedemail.com (Postfix) with ESMTP id 5596F1C0078 for ; Wed, 13 Jul 2022 02:12:48 +0000 (UTC) Date: Tue, 12 Jul 2022 19:12:38 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1657678366; 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=L4NZMHvEd+Wz6R+icJlQASumnTXEnRzXAIOG4yiXNsk=; b=eQXlx0GekEOodGnpP3rbICE7PWmnbaEn5Bt9naVGNBeckp8ips0W95/6bZToNA0f9wIHB3 hwp4wkv7UibOfK+dGn7uQIwulbvVZs02/CptqrZFNSnXJjSWrgXVkkgPr9UsZ1wWqv1WnL BBHJvOdUcLucayTRa6xdG1LJ9fUP4MY= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Roman Gushchin To: Alexei Starovoitov Cc: Shakeel Butt , Yafang Shao , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Quentin Monnet , Hao Luo , bpf , Linux MM , NeilBrown Subject: Re: [PATCH bpf-next v3 1/2] bpf: Make non-preallocated allocation low priority Message-ID: References: <20220709154457.57379-1-laoar.shao@gmail.com> <20220709154457.57379-2-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 ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=eQXlx0Ge; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf21.hostedemail.com: domain of roman.gushchin@linux.dev designates 188.165.223.204 as permitted sender) smtp.mailfrom=roman.gushchin@linux.dev ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1657678368; 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=L4NZMHvEd+Wz6R+icJlQASumnTXEnRzXAIOG4yiXNsk=; b=gtYmb0ea21Ayy7OxRFG6hKGztdE7Kj312sZnsHk4KZHZSoGzlxCNyr9+3Aw5fjqj5ACQsH BTD6zUOMzE7szbgo6prSU3v13XD0eaj4WaeFq6rk5W+sNJC5COPJnWlcSSIuk1geUyP8XN RlzmPP3UznrKHt2LZU8AXKH1Ig81kmo= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1657678368; a=rsa-sha256; cv=none; b=LFU7UEmhLk/ezs7JAYDaNQKk5u1i3QTZ06hAScG76iM9t9cnQ6mfl7KwNsX+ZRx5rjzs+T qEK/92/4pOa6pS5Uxs66ta2vR9dlOIofrkuqARKUoG7ic1/Csmp4MxVyh3K6isCbzZrGDM 6oAoCd6vBuzrmpxoMcPAcfax9VSphmI= X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 5596F1C0078 X-Stat-Signature: nzehyxcjzpf3m6n35okbjzxaj435zi3b Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=eQXlx0Ge; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf21.hostedemail.com: domain of roman.gushchin@linux.dev designates 188.165.223.204 as permitted sender) smtp.mailfrom=roman.gushchin@linux.dev X-Rspam-User: X-HE-Tag: 1657678368-522284 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 Tue, Jul 12, 2022 at 05:49:24PM -0700, Alexei Starovoitov wrote: > On Mon, Jul 11, 2022 at 12:19 PM Shakeel Butt wrote: > > > > On Sat, Jul 9, 2022 at 8:45 AM Yafang Shao wrote: > > > > > > GFP_ATOMIC doesn't cooperate well with memcg pressure so far, especially > > > if we allocate too much GFP_ATOMIC memory. For example, when we set the > > > memcg limit to limit a non-preallocated bpf memory, the GFP_ATOMIC can > > > easily break the memcg limit by force charge. So it is very dangerous to > > > use GFP_ATOMIC in non-preallocated case. One way to make it safe is to > > > remove __GFP_HIGH from GFP_ATOMIC, IOW, use (__GFP_ATOMIC | > > > __GFP_KSWAPD_RECLAIM) instead, then it will be limited if we allocate > > > too much memory. There's a plan to completely remove __GFP_ATOMIC in the > > > mm side[1], so let's use GFP_NOWAIT instead. > > > > > > We introduced BPF_F_NO_PREALLOC is because full map pre-allocation is > > > too memory expensive for some cases. That means removing __GFP_HIGH > > > doesn't break the rule of BPF_F_NO_PREALLOC, but has the same goal with > > > it-avoiding issues caused by too much memory. So let's remove it. > > > > > > This fix can also apply to other run-time allocations, for example, the > > > allocation in lpm trie, local storage and devmap. So let fix it > > > consistently over the bpf code > > > > > > It also fixes a typo in the comment. > > > > > > [1]. https://lore.kernel.org/linux-mm/163712397076.13692.4727608274002939094@noble.neil.brown.name/ > > > > > > Cc: Roman Gushchin > > > Cc: Shakeel Butt > > > Cc: NeilBrown > > > Signed-off-by: Yafang Shao > > > > Reviewed-by: Shakeel Butt > > Applied to bpf-next. Looks like I'm a bit late to the party, but my ack still applies. Thanks!