Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp7194521rwl; Mon, 9 Jan 2023 19:53:11 -0800 (PST) X-Google-Smtp-Source: AMrXdXtqYu7uZ7Cy5oUDU3uxqSpJL4vPbZBZcka+NSMb4w0CSLkVjRdSoKSDBqpvysz4OfMCyus3 X-Received: by 2002:a05:6a20:a028:b0:b5:df4f:6731 with SMTP id p40-20020a056a20a02800b000b5df4f6731mr6181664pzj.17.1673322791210; Mon, 09 Jan 2023 19:53:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673322791; cv=none; d=google.com; s=arc-20160816; b=JtNk+VLOu+LoDeWa0rsoa0azXKUdSFi4T/VpIrRYfW8qEBsyRFyTb7YkuhPTLWwrY2 EKlfevCLtOnTrGPNvx5casQrEvGikZo/hXLdarudlWpwEQg5c4fAkUFFRLn6qN4JvjW4 FcsFfhzpaTaVMRk+Zghh10K3h0Yu9Q8oYTuHeUpRsEQDRuWQMGIlPppKhadsKUEs2IIG 8tKbomFHRsXIY/NaWmCGVMaPZpSuxfUCiTaHabNXQnUjB7HeLFVxEGYs6teAo4VpsYtN 50q5ySmiXq3xswLpVRVGQ7CF1sBrFLgy0/AYgN7rIu8D7vnsMkU4MlBPlX0Q8x1b9qRV 3zWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=CRENz8ZbjuD4af3iArVZgtXNxjyoLolSK+jc4X9pWIU=; b=Hbf0qGCht0wdXnkl6oSlQ7UV+1E9KXKjNk2xmQnxVfByk4MWd5RIUA0QiHCYriYZ16 5xfKMXXlpal2U10nZti+XSTs3QMUiGddb4uNqm/MT/l6HD74zBlwV1hVFY9to3xrNC09 viVuOWa4YTDDfZtc3pv3bw7nIQUof3pPRub/yppXodqRy+AIUlTlvZuqMZy/i1dnx+eX iueKiM6yzCP89x/o8ioeHVEcRGy3EFEvblsPexnLjSFOMRXsOQ/a9WzGxfY5ieCtgZpC lInEPgknB7zDZB7Vp8YL29YQeDofC8W5+NqhzfwA5+2Vzye8T54CpeSlMIMwhWzGfr8j YlJA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e188-20020a6369c5000000b004a03cdc3f29si10512894pgc.140.2023.01.09.19.53.04; Mon, 09 Jan 2023 19:53:11 -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; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229800AbjAJD3O (ORCPT + 53 others); Mon, 9 Jan 2023 22:29:14 -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 X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,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 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/