Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp1415754pxv; Fri, 2 Jul 2021 03:19:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxKiWVQX3zuGNhyWt1eFGm45eDuKuGKd2ej012L+cznKt5Lw1atUg3Xg/QE67XkZ2bthRb8 X-Received: by 2002:a05:6602:15c5:: with SMTP id f5mr3177242iow.53.1625221163589; Fri, 02 Jul 2021 03:19:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625221163; cv=none; d=google.com; s=arc-20160816; b=SOp7ARbE0UbHzb0kCrcVqfkyrLhoeIJN4RLD3g5ds/T4BNvvOP3LWAevgQe8TSTLiO NV3qeFvvrhWKn3xxl+ejbZbtz6ZXZ6RQygCgV/9WMS6QOygkj9QLb4Udp0nUiaT5RNpV ocemjY4VFrMpJbNFI0dppitbbm/OUCJMIXbKPN+hqmOxWRHNFbPtALVxvZIUtpjZTHkO QgK4yVDNUTeoJxknVL52uzV8OKToht/qEFrY+QoyE5/Qoh+yndDz/JokPCbE3P4n3TNP K+cwHkFtiOBTZ0W9iwtviHjj9kLf1mEbufEyZRlDQA8NNv9ugYjIQZKLLYXBm8owcegh pZTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=9PMRM8xXwoMiBDJbmoL245y42jshUeS2hh6r01d2iHM=; b=ECN7uPE0JPTQ8BgpBuTuwgpD82NrsuVp9Dbn3zLHVMPwMnYDdegNvGl25YNy5g9mhG Oa76FPg1iu14jWqQ0i7IIZe9bnCXLIvapSCgMFtmqgGrWCpyVc2pqE2QiNRYcPAvJKn2 Xed+IvZB9dqN8V1u1QSNkqt9IzTCj24K9zUsn69heFGGYLZCUxfPq9RN/QX1TR2yF6I5 CqiyKpd4zX3k+GKS2eCDsUtJuif/TKiwae0HaohRvg0CfWk9NW734l9vfSLaokdE26iR zhRJ/yPU8V/T80H7iZzZU8U75sEqtGUrGrGHvwpXoJnuZiwCKIe+r424aNMAKH8GGnpj 5cAw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f12si3467103iow.49.2021.07.02.03.19.11; Fri, 02 Jul 2021 03:19:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231151AbhGBKRv (ORCPT + 99 others); Fri, 2 Jul 2021 06:17:51 -0400 Received: from szxga03-in.huawei.com ([45.249.212.189]:9336 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230351AbhGBKRs (ORCPT ); Fri, 2 Jul 2021 06:17:48 -0400 Received: from dggemv703-chm.china.huawei.com (unknown [172.30.72.56]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4GGW7Q1W0hz74gT; Fri, 2 Jul 2021 18:10:58 +0800 (CST) Received: from dggpemm500005.china.huawei.com (7.185.36.74) by dggemv703-chm.china.huawei.com (10.3.19.46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Fri, 2 Jul 2021 18:15:13 +0800 Received: from [10.69.30.204] (10.69.30.204) by dggpemm500005.china.huawei.com (7.185.36.74) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2176.2; Fri, 2 Jul 2021 18:15:13 +0800 Subject: Re: [PATCH net-next RFC 1/2] page_pool: add page recycling support based on elevated refcnt To: Jesper Dangaard Brouer , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Alexander Duyck References: <1625044676-12441-1-git-send-email-linyunsheng@huawei.com> <1625044676-12441-2-git-send-email-linyunsheng@huawei.com> <6c2d76e2-30ce-5c0f-9d71-f6b71f9ad34f@redhat.com> From: Yunsheng Lin Message-ID: Date: Fri, 2 Jul 2021 18:15:13 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.2.0 MIME-Version: 1.0 In-Reply-To: <6c2d76e2-30ce-5c0f-9d71-f6b71f9ad34f@redhat.com> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.69.30.204] X-ClientProxiedBy: dggeme709-chm.china.huawei.com (10.1.199.105) To dggpemm500005.china.huawei.com (7.185.36.74) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021/7/2 17:42, Jesper Dangaard Brouer wrote: > > On 30/06/2021 11.17, Yunsheng Lin wrote: >> Currently page pool only support page recycling only when >> refcnt of page is one, which means it can not support the >> split page recycling implemented in the most ethernet driver. > > Cc. Alex Duyck as I consider him an expert in this area. Thanks. > > >> So add elevated refcnt support in page pool, and support >> allocating page frag to enable multi-frames-per-page based >> on the elevated refcnt support. >> >> As the elevated refcnt is per page, and there is no space >> for that in "struct page" now, so add a dynamically allocated >> "struct page_pool_info" to record page pool ptr and refcnt >> corrsponding to a page for now. Later, we can recycle the >> "struct page_pool_info" too, or use part of page memory to >> record pp_info. > > I'm not happy with allocating a memory (slab) object "struct page_pool_info" per page. > > This also gives us an extra level of indirection. I'm not happy with that either, if there is better way to avoid that, I will be happy to change it:) > > > You are also adding a page "frag" API inside page pool, which I'm not 100% convinced belongs inside page_pool APIs. > > Please notice the APIs that Alex Duyck added in mm/page_alloc.c: Actually, that is where the idea of using "page frag" come from. Aside from the performance improvement, there is memory usage decrease for 64K page size kernel, which means a 64K page can be used by 32 description with 2k buffer size, and that is a lot of memory saving for 64 page size kernel comparing to the current split page reusing implemented in the driver. > > __page_frag_cache_refill() + __page_frag_cache_drain() + page_frag_alloc_align() > > [...]