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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 62A6BC10DC1 for ; Thu, 30 Nov 2023 09:01:03 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CDAB26B0452; Thu, 30 Nov 2023 04:01:02 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id C630E6B0453; Thu, 30 Nov 2023 04:01:02 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id ADDE96B0454; Thu, 30 Nov 2023 04:01:02 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 9ACFE6B0452 for ; Thu, 30 Nov 2023 04:01:02 -0500 (EST) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 30DABC0142 for ; Thu, 30 Nov 2023 09:01:02 +0000 (UTC) X-FDA: 81514025964.10.7D73199 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf10.hostedemail.com (Postfix) with ESMTP id D3F22C0038 for ; Thu, 30 Nov 2023 09:00:57 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf10.hostedemail.com: domain of linyunsheng@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=linyunsheng@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1701334859; a=rsa-sha256; cv=none; b=suczytxgUONUyFttAvrl0t+7DwdC0nwkZY2fA55l4v8XpOhQ6Il5yB4XocYbak3IBMPYbG Qtioai268+lOa0w8ZSeIZs3QisTsYStBAId4FSoGxsrI+hg1RrVKJC0pzsJ/TOVvjm7drs mfhvOi6TOwpuVEdS97tR07GZFV0wORY= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf10.hostedemail.com: domain of linyunsheng@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=linyunsheng@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1701334859; h=from:from:sender: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=G+FPQsfAbx3MHEjgdf8wd+ryRbdTahJ0qQB+7cWSZLI=; b=Lr7XSFyqgzVDYVFg95IxseBGP8D2Gh1SHGQ2Y5ZXTyJWrAS7cR8hdXcP3ZoGUvcfWEfpSZ bB5PLQ6kEtxc11bOLmJuuD1kZEQyohMKBCL9ByApFmpuW8f+NBDgvBqjGD/8mfMDN9ACqs yG3dSpZyaGWrgG/qLt1MS+HmrOBLnAY= Received: from dggpemm500005.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Sgqnj1l50zsR46; Thu, 30 Nov 2023 16:57:13 +0800 (CST) 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_GCM_SHA256) id 15.1.2507.35; Thu, 30 Nov 2023 17:00:52 +0800 Subject: Re: [PATCH net-next 03/12] mm: Make the page_frag_cache allocator alignment param a pow-of-2 To: Alexander H Duyck , David Howells , CC: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Willem de Bruijn , David Ahern , Matthew Wilcox , Jens Axboe , , , Jeroen de Borst , Catherine Sullivan , Shailend Chand , Felix Fietkau , John Crispin , Sean Wang , Mark Lee , Lorenzo Bianconi , Matthias Brugger , AngeloGioacchino Del Regno , Keith Busch , Jens Axboe , Christoph Hellwig , Sagi Grimberg , Chaitanya Kulkarni , Andrew Morton , , , References: <20230524153311.3625329-1-dhowells@redhat.com> <20230524153311.3625329-4-dhowells@redhat.com> <51161740e832334594960ed43430b868a6f892c3.camel@gmail.com> From: Yunsheng Lin Message-ID: Date: Thu, 30 Nov 2023 17:00:52 +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: <51161740e832334594960ed43430b868a6f892c3.camel@gmail.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: dggems704-chm.china.huawei.com (10.3.19.181) To dggpemm500005.china.huawei.com (7.185.36.74) X-CFilter-Loop: Reflected X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: D3F22C0038 X-Stat-Signature: pu5i61788mcb47xd7et4dekiugkt61mk X-Rspam-User: X-HE-Tag: 1701334857-650184 X-HE-Meta: U2FsdGVkX1++3gdrXzKqgxQ/RmxA8ogXcDlUt/K9ilE2yIf8/fT+uogmKa0ZMPG/G62xxcJiJaFgbmO12NDgj8Akqcx8T92sE0/BNm9JKYriDd0ad6qqCpC7a9Vwe0sqQwDzFAhqnHbZO5m5y2nH2FAdKJewOxNgvaEiCFfRnB0Z6SKWt74bVV1HzQNBd7CDOTxEzfd+fBJdiRi8AkODVlf3oQURXRw1YcbJoEtF5t0IZ89bkKL79wgo7UZ2yTineCu9uP6IeT/dm0shjV+rRtbo7JK/+wTv2+Pt4SRW+NXqS++aRHRyRJkmiec8nmoj3vmnL7ayaM9y2wWW/DA1asJP+Hw4l7XVUiQw0Y/0fBNyVEDWu/rzbzLHLx6PNH6djutrdVgxQLkkfPl4WTjiSH7jbYSdHUr1w4pHfbpCCBAVKWw3OL86pCxP0P0ihFA5zHUTXhJ6BgUsjxNCCNSdMj/9ncBH8IOtrTjtHB8jteEIEJyOmHCUmxvSXNnF5RXg77XQL9GgHhZ2at2xHIvZeoWvSWHR+Us9OXyIvg/5lFq2hH+oTsHvHKe7k7iMM99QJnT7DB8ZYFAjlW0znxbdussraxP19Ng4XjV3NfKeD+1TFe3ZTZqtCo19lR6KnSLGoyx8okiu/ZPXyxBWxgGZf0CSA10J6Wg5KJ4pB1oWvM54xteYS0g9Q2DQICCMLcJYGL/mNsAmA7foMbj5We5GnI+dCuzq+Id9OlemEKSJdDJLMs9pvgQkJ0gAHRSKwC5UvgVbOC5HDQoPcybJD3WqQkWsVgZqyehF6aXauLQJUQ8c5WAVuxBFFMh7ets0flUdDB6rfQK0mdnOU7bFMnqhHLgcQcH7GiSrYXoznVloE3v5+EKNQEFIqC1DfjsB4qvmdmz4T3D2ddr31aiCk+0D7Ytgf41VsmzbcWIcvfF81B2EZ2Jdt5D++LPpCDHqIi44UA7jzA/505GAljsU+lL pKUPCHGE 1QplheAH2zBsPa+8Vc/DnTROm5bG2zIVQWbSozzuBAQVhUUG4RQSTCnREk5y3XhgnACCgkY2B1C+EoYLdGeoA1BotVuL0wQxCmhReGAYhDNI7mTP7su/8AlBU9VHn8Kck/f05jRL3wG6UktxiVD3OYkxhcoIyeDT5Iai/9CEXiFFFwQtVoSyXRf9YvvTbt3uxR4Xdk+rCgQ1d5LWBZcovM0Wm8HS1kcILOFDJTtEsH+zWr0u4OLRr/YnBnlwHTgFF1yBh X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On 2023/5/27 23:54, Alexander H Duyck wrote: > On Wed, 2023-05-24 at 16:33 +0100, David Howells wrote: >> Make the page_frag_cache allocator's alignment parameter a power of 2 >> rather than a mask and give a warning if it isn't. >> >> This means that it's consistent with {napi,netdec}_alloc_frag_align() and >> allows __{napi,netdev}_alloc_frag_align() to be removed. I am trying to rmove the page frag implemetation in vhost_net_page_frag_refill() by using page_frag_alloc_align(), and I ended up having a simiar patch as this one. >> > > This goes against the original intention of these functions. One of the > reasons why this is being used is because when somebody enables > something like 2K jumbo frames they don't necessarily want to have to > allocate 4K SLABs. Instead they can just add a bit of overhead and get > almost twice the utilization out of an order 3 page. > > The requirement should only be cache alignment, not power of 2 > alignment. This isn't meant to be a slab allocator. We are just > sectioning up pages to handle mixed workloads. In the case of > networking we can end up getting everything from 60B packets, to 1514B > in the standard cases. That was why we started sectioning up pages in > the first place so putting a power of 2 requirement on it doens't fit > our use case at all and is what we were trying to get away from with > the SLAB allocators. It seems that is_power_of_2() checking in this patch does not excluding the non-align case if we are passing 'align' being 1, which means we still can support the 'everything from 60B packets, to 1514B' case. > > . >