Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp7351864rwl; Mon, 9 Jan 2023 22:50:42 -0800 (PST) X-Google-Smtp-Source: AMrXdXs/+Y9UN4/lGEC9RlCr/VqRztVDxuWSBAWexrVLACn/wUY2M9+pxbjr3BMyvEf7lKU3RMeE X-Received: by 2002:a05:6a20:bf13:b0:b6:11f9:8227 with SMTP id gc19-20020a056a20bf1300b000b611f98227mr1176024pzb.36.1673333442658; Mon, 09 Jan 2023 22:50:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673333442; cv=none; d=google.com; s=arc-20160816; b=C7Jll3RSBVYgg9R0LvQiQH7isG0D7PZcgmgwGIyKkWMYGPkA4PiOUFsnImxiJcAQwM OS9dBKIZM3c7UMbWyJICT+6WezMNH82iBSBa5Gmx5Iensijfxs3bmk5jiAvJBIzuP290 wD7pcRusp+psleVGs+Kay+EQ3BpWo84oIlFKuAKmtXHcEX16vqyX63mmimAPgrUQ1IsW MJAtqBk0m20t0zsbnv0pX8Xzk/7XtFFBKlGWHS9N1L6ZsOpJExOVUyky93Vn4cL1skIJ twVXgQXGgOBdp6Hi6yPXXtGA0ZUB/v348qr80GZ40Eg+rX7MK5hw/HBDG3E/1wbv/0k1 yYuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:mime-version:date :dkim-signature:message-id; bh=8r5fNA8nobsSLbYvyb9u+9ODco9RBnJ4ampTJzFDYfg=; b=UpD+5wGBq5ClTIVJSGtnY9uJkMRBLpag5GYlnj3j1LOzN0L/h/PfpwCZ09qdN3Re8C +vIo5IzvsnUdCsqgnwceVs1DNOqPSY9Z0ByvMnZunFg/0EpSnnGdAgwlWx7Hdy0OnKZd 7i9D+vP2lR1Daf+N63AsSZWEXpQOEnOFgQBRHiHi23CoK5t1iapbSYa0t/7vgXu73G5o 82YGMOGIIpZ80X282VI+iHeqUuP7xmn9b/qDjY3q6uYFcC+C/nHWTwl6xDPWNkai0hK6 QNdaooSEzltVnwtVdG3Ds+tUSQlARt4UJvIe18iYXUHJS9aE8981SpdCHaEkrmkoa3/p 9q0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b="JHAgrk/s"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n64-20020a632743000000b00478e26efc95si10749020pgn.34.2023.01.09.22.50.35; Mon, 09 Jan 2023 22:50:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b="JHAgrk/s"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230312AbjAJG3V (ORCPT + 53 others); Tue, 10 Jan 2023 01:29:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50404 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230020AbjAJG3S (ORCPT ); Tue, 10 Jan 2023 01:29:18 -0500 Received: from out2.migadu.com (out2.migadu.com [188.165.223.204]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7400F395D1; Mon, 9 Jan 2023 22:29:17 -0800 (PST) Message-ID: <5e8cc542-763b-9db2-55e4-fb59920bc145@linux.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1673332155; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8r5fNA8nobsSLbYvyb9u+9ODco9RBnJ4ampTJzFDYfg=; b=JHAgrk/sFWXz8USqHZlbwdzL46r9Wd9A6x2MF7OL1T7YTsYT+8LdCAJ3NajtXxkvnm86Et jr9ZrWp18QEwhRVPxVQQButU0Jnnse1XSI5W/fibYryQHlmQ2fyTyB/FeRMvFBUP9MLjY6 fTN71sWVP1dkLd2k91S4Q+uZPY7cPlo= Date: Mon, 9 Jan 2023 22:29:11 -0800 MIME-Version: 1.0 Subject: Re: [PATCH] perf lock contention: Do not use BPF task local storage Content-Language: en-US To: Hou Tao Cc: Alexei Starovoitov , Ingo Molnar , Peter Zijlstra , LKML , Ian Rogers , Adrian Hunter , linux-perf-users@vger.kernel.org, Song Liu , bpf@vger.kernel.org, Blake Jones , Chris Li , Arnaldo Carvalho de Melo , Jiri Olsa , Namhyung Kim References: <20221118190109.1512674-1-namhyung@kernel.org> <7ec772fb-2108-5945-a308-4bb46fcf0090@linux.dev> <6e4ec7a4-9ac9-417c-c11a-de59e72a6e42@huawei.com> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Martin KaFai Lau In-Reply-To: <6e4ec7a4-9ac9-417c-c11a-de59e72a6e42@huawei.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 1/9/23 7:29 PM, Hou Tao wrote: > Hi Martin, > > On 1/10/2023 5:22 AM, Martin KaFai Lau wrote: >> On 1/9/23 12:56 PM, Namhyung Kim wrote: >>> Hello, >>> >>> On Mon, Nov 21, 2022 at 9:33 AM Martin KaFai Lau wrote: >>>> >>>> On 11/18/22 11:01 AM, Namhyung Kim wrote: >>>>> We could fix the task local storage to use the safe BPF allocator, >>>>> but it takes time so let's change this until it happens actually. >>>> >>>> I also got another report on the kfree_rcu path.  I am also looking into this >>>> direction on using the BPF allocator. >>> >>> Any progress on this?  Are there any concerns about the change? >> >> Yep, I am working on it. It is not a direct replacement from kzalloc to >> bpf_mem_cache_alloc. eg. Some changes in the bpf mem allocator is needed to >> ensure the free list cannot be reused before the rcu grace period. There is a >> similar RFC patchset going into this direction that I am trying with. >> >> . > Do you mean "[RFC PATCH bpf-next 0/6] bpf: Handle reuse in bpf memory alloc" > [0], right ? Yes, that is the RFC patch I was referring :). I was planning to comment after looking at the patch in details. I have shared some of my quick thoughts in that thread for the local storage usages. > The main concern [1] for the proposal is the possibility of OOM > will increase when RCU tasks trace grace period is slow, because the immediate > reuse is disabled and the reuse is only possible after one RCU tasks trace grace > period. Using a memory cgroup and setting a hard-limit on the cgroup may reduce > the influence of the OOM problem, but it is not good enough. So do you have > other ways to mitigate the potential OOM problem ? > > [0]: https://lore.kernel.org/bpf/20221230041151.1231169-1-houtao@huaweicloud.com/ > [1]: > https://lore.kernel.org/bpf/CAADnVQ+z-Y6Yv2i-icAUy=Uyh9yiN4S1AOrLd=K8mu32TXORkw@mail.gmail.com/