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 28422C63797 for ; Tue, 10 Jan 2023 03:29:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229868AbjAJD3P (ORCPT ); Mon, 9 Jan 2023 22:29:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50408 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229493AbjAJD3L (ORCPT ); Mon, 9 Jan 2023 22:29:11 -0500 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 08CDC1EEF9; Mon, 9 Jan 2023 19:29:09 -0800 (PST) Received: from dggpeml500025.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Nrbps3lCnznVBX; Tue, 10 Jan 2023 11:27:33 +0800 (CST) Received: from [10.174.176.117] (10.174.176.117) by dggpeml500025.china.huawei.com (7.185.36.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Tue, 10 Jan 2023 11:29:06 +0800 Subject: Re: [PATCH] perf lock contention: Do not use BPF task local storage To: Martin KaFai Lau , Alexei Starovoitov CC: Ingo Molnar , Peter Zijlstra , LKML , Ian Rogers , Adrian Hunter , , Song Liu , , 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> From: Hou Tao Message-ID: <6e4ec7a4-9ac9-417c-c11a-de59e72a6e42@huawei.com> Date: Tue, 10 Jan 2023 11:29:06 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: <7ec772fb-2108-5945-a308-4bb46fcf0090@linux.dev> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Content-Language: en-US X-Originating-IP: [10.174.176.117] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To dggpeml500025.china.huawei.com (7.185.36.35) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 ? 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/