Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp4959024rwb; Sun, 4 Dec 2022 11:23:57 -0800 (PST) X-Google-Smtp-Source: AA0mqf7egipLKEYq9VotvzEiSTC2AXEDusWZ7+HixFMa2/jxkDR5nTTbREv9qCWRpnRRxWQDzmpY X-Received: by 2002:a17:906:688f:b0:7c0:ced7:7c99 with SMTP id n15-20020a170906688f00b007c0ced77c99mr7746474ejr.401.1670181837464; Sun, 04 Dec 2022 11:23:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670181837; cv=none; d=google.com; s=arc-20160816; b=KEQ0HDhkgLucktUGLFkrOoNTRDpP/V3x6PfKOk/LvaHZR7Ge3+CLMcD3FhpHRVEYVD 7xwZWW9LDwbichIDd7x8YPjvOvGuMfvG5F8+eBNwC7aeEyOJTPejfB3M4To92RMRy8cb doXVVQfjdmJ+H0jL+17H+FQnLrrXAKw0OvzA2eELomPnq4ALoSnSjYAFreZJY55tbZhw cSjLJFk49/d2ogU12JYtsha4pMwdayAXsPmHXuUnrKGYBaN3OLyaXG8XY9Xj5JZPfKOR Hh9YpswHMXilKEkhZPfNpcCfRqbLzAye7mRngh2ZVhoNJhN58xmNui4RLs/Q003Ik5Fg 4bZw== 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:user-agent:mime-version :date:message-id:dkim-signature; bh=3vGbnOeq4kzljzirvL5pjkAxrpSozfhAG6ODaOPHYw4=; b=rO8zAMqa1CfJMYp4KigZ0y2Sb/7Cn+prk/4t5OuxnutA6Tdcv+PPAk+FhuFb5wHRgy UL7KOxi9mKqaPpDisQce/Z5UqMyTF1l71lw9zIw0HW3RaM9Qhrwc1FxwNjK5oTR3lbbO iy1HQl060PSwSgw15vfP+58KyG0Jmu7dBofq5f+xLxHlj+THIoA3bsryEzZ7+Lz0qm7r 2aioRA49p7D+Ts1GYyrz0J9NStoUwmOr4XLnF3hs+S+3pblsiBZm+1XyccfBEtHoKPgM ciHlXQMg6COD0PYprKTYLH7j9FBXE1xZ9NCvvaAB2g9trzmY6YKz2LU1j/2tvvoCA2oH 0FkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=SK+J0e+c; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y18-20020a056402271200b00467238595easi7106006edd.369.2022.12.04.11.23.38; Sun, 04 Dec 2022 11:23:57 -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=@gmail.com header.s=20210112 header.b=SK+J0e+c; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230322AbiLDS6f (ORCPT + 83 others); Sun, 4 Dec 2022 13:58:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57650 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230242AbiLDS6b (ORCPT ); Sun, 4 Dec 2022 13:58:31 -0500 Received: from mail-ej1-x62c.google.com (mail-ej1-x62c.google.com [IPv6:2a00:1450:4864:20::62c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8409013F56; Sun, 4 Dec 2022 10:58:27 -0800 (PST) Received: by mail-ej1-x62c.google.com with SMTP id fc4so16088738ejc.12; Sun, 04 Dec 2022 10:58:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=3vGbnOeq4kzljzirvL5pjkAxrpSozfhAG6ODaOPHYw4=; b=SK+J0e+cOF/gJbHdLxeV7lh37lbbvFSCOUHLAc5Bz2c7Gep4IX9vNEDlsq1rBER3C9 eEcrqt9aSrGir+v/mK8rWOSE1jU9xY5I21o+B3WyW646xZ7o9EgWPM38Z669uLk1lY/R 53Aer7L/UtA27fo/AQqxuehOcbxuyp1m9zqC1HD56dGoQs7j7wHg0FhAePCMOd+LNof3 8lk7yILEv2YOHjyedBQg/rDiGO+pST3ju+QQScTTp7TRZjiK7lRrkUdvAPGeS8zvpHh/ QXvs8k/MigJPFlxy3U46QJDTSyfqvsC+NlK6x+lXXLix61KS4vv08Ni8b9vFUX8OFNu+ 2qEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=3vGbnOeq4kzljzirvL5pjkAxrpSozfhAG6ODaOPHYw4=; b=x0soWV+29Y110MFwE1D8BxQV1nlaYrzPFXZRyToh47QA8MmUcdNZCtmUCIPIaCEh3X izndXHzYXdfT2pHD0OBCHG7+YAPYp3GceIoJVkSF407WgYHi0E5ewUs3U17WgDZcI8sT 97c/mWJhH+FDPgPjnrPlA0o+3s9V8KjqGHERriXRT+wgl5o7/ey44yS4hwuCdu0kZuaj 6p+4v2zfzBqtdt+2tWmH1b2u3DBarQNiFGV+R5I4iNG7v3Qtq0x3hfNCJq/pE9ytG2CT ZOG4R7SxFhOXzVOeOxSYWsfhPVP91VUHyftsDmop1gZxK7xBUVlq9aOLuriLM7k8X/6T 1YOg== X-Gm-Message-State: ANoB5pnWHj17O6zK+/HrQx2ibvWMTtxuggxBqv3hodeXY1UYaZ57MYJm OmxvNYwPHj0tXUqTBO8Bn+I= X-Received: by 2002:a17:906:7953:b0:7bf:944e:cf6e with SMTP id l19-20020a170906795300b007bf944ecf6emr28321277ejo.638.1670180306173; Sun, 04 Dec 2022 10:58:26 -0800 (PST) Received: from [192.168.1.101] ([37.252.91.128]) by smtp.gmail.com with ESMTPSA id 14-20020a170906318e00b007aed2057ea1sm5342266ejy.167.2022.12.04.10.58.23 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 04 Dec 2022 10:58:25 -0800 (PST) Message-ID: <14db8809-6144-1d10-59e7-298079b2e6e2@gmail.com> Date: Sun, 4 Dec 2022 22:58:21 +0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.5.0 Subject: Re: [PATCH net-next v1 02/13] net: wwan: tmi: Add buffer management Content-Language: en-US To: Yanchao Yang , Loic Poulain , Johannes Berg , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev ML , kernel ML Cc: MTK ML , Liang Lu , Haijun Liu , Hua Yang , Ting Wang , Felix Chen , Mingliang Xu , Min Dong , Aiden Wang , Guohao Zhang , Chris Feng , Lambert Wang , Mingchuang Qiao , Xiayu Zhang , Haozhe Chang , MediaTek Corporation References: <20221122111152.160377-1-yanchao.yang@mediatek.com> <20221122111152.160377-3-yanchao.yang@mediatek.com> From: Sergey Ryazanov In-Reply-To: <20221122111152.160377-3-yanchao.yang@mediatek.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,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 On 22.11.2022 15:11, Yanchao Yang wrote: > From: MediaTek Corporation > > To malloc I/O memory as soon as possible, buffer management comes into being. > It creates buffer pools that reserve some buffers through deferred works when > the driver isn't busy. > > The buffer management provides unified memory allocation/de-allocation > interfaces for other modules. It supports two buffer types of SKB and page. > Two reload work queues with different priority values are provided to meet > various requirements of the control plane and the data plane. > > When the reserved buffer count of the pool is less than a threshold (default > is 2/3 of the pool size), the reload work will restart to allocate buffers > from the OS until the buffer pool becomes full. When the buffer pool fills, > the OS will recycle the buffer freed by the user. > > Signed-off-by: Mingliang Xu > Signed-off-by: MediaTek Corporation > --- > drivers/net/wwan/mediatek/Makefile | 3 +- > drivers/net/wwan/mediatek/mtk_bm.c | 369 ++++++++++++++++++++++++++++ > drivers/net/wwan/mediatek/mtk_bm.h | 79 ++++++ > drivers/net/wwan/mediatek/mtk_dev.c | 11 +- > drivers/net/wwan/mediatek/mtk_dev.h | 1 + > 5 files changed, 461 insertions(+), 2 deletions(-) > create mode 100644 drivers/net/wwan/mediatek/mtk_bm.c > create mode 100644 drivers/net/wwan/mediatek/mtk_bm.h Yanchao, can you share some numbers, how this custom pool is outperform the regular kernel allocator? -- Sergey