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 8735CC46CD2 for ; Tue, 9 Jan 2024 11:22:26 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0BA206B0074; Tue, 9 Jan 2024 06:22:26 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 0434F6B008C; Tue, 9 Jan 2024 06:22:26 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E746F6B0092; Tue, 9 Jan 2024 06:22:25 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id D6FED6B008A for ; Tue, 9 Jan 2024 06:22:25 -0500 (EST) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id B12171202BA for ; Tue, 9 Jan 2024 11:22:25 +0000 (UTC) X-FDA: 81659534250.19.F061536 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf23.hostedemail.com (Postfix) with ESMTP id AA87214001E for ; Tue, 9 Jan 2024 11:22:22 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=none; spf=pass (imf23.hostedemail.com: domain of linyunsheng@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=linyunsheng@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1704799344; a=rsa-sha256; cv=none; b=OJf0gbibmswi44v4hh8d/V4OMLm/SzMVGSfVOMgbYnk8pu9lNT7leCYLCqK4bsL0y6AyDJ a3LCGMBOnveC2Q14AuQRfKKUcPuMGi3ggIIqfpZFHn25zvCU9UzyviRf8zHl90x/LfOF2t YONqynXaN4qJSpod9xEkTIdK1GLlr3A= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=none; spf=pass (imf23.hostedemail.com: domain of linyunsheng@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=linyunsheng@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1704799344; 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=4Lmo6d2EfD1dY85wTg6i175XFTzaugdffana3QtulWI=; b=f4SH3SqpYJr57KZ/BBL+iREi+RltfSGF2LFMwiKe85TUmtLE8tPg9On2EpXpAirqAQRjUP lnYXgGpEUCCW835smErQLsWVlO12528yPws+y4I6mZNZYRlFTy+J/Su+1vqLDTOZNBsZxE JCDfQ7sdWQGFLlqldiAYWw2L4h3LAEU= Received: from mail.maildlp.com (unknown [172.19.88.105]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4T8T593hd4zvQPy; Tue, 9 Jan 2024 19:21:01 +0800 (CST) Received: from dggpemm500005.china.huawei.com (unknown [7.185.36.74]) by mail.maildlp.com (Postfix) with ESMTPS id 90CCE14011F; Tue, 9 Jan 2024 19:22:17 +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; Tue, 9 Jan 2024 19:22:17 +0800 Subject: Re: [PATCH net-next 3/6] mm/page_alloc: use initial zero offset for page_frag_alloc_align() To: Alexander Duyck CC: , , , , , Andrew Morton , References: <20240103095650.25769-1-linyunsheng@huawei.com> <20240103095650.25769-4-linyunsheng@huawei.com> <74c9a3a1-5204-f79a-95ff-5c108ec6cf2a@huawei.com> From: Yunsheng Lin Message-ID: Date: Tue, 9 Jan 2024 19:22:16 +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: Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 8bit X-Originating-IP: [10.69.30.204] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggpemm500005.china.huawei.com (7.185.36.74) X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: AA87214001E X-Stat-Signature: 1db9dqpzkfnieon3joowcber3f1i4nzi X-HE-Tag: 1704799342-284449 X-HE-Meta: U2FsdGVkX18bskONWMy9mWigB/7m4LiPrWTBilZJD3Qb+nLwls3XFLIoWzY4ZJzd0PUFwgMeaI19SMPCALTFo6PlkvPYrTbQuJ0zTDmbpXZ+gfcLD2dS21Hbe6kB9OLBG+0Ci082Y4gka3rWmywylsXD7NXgTPcDcyvHRm98ydFz2w7dSqCosL+UMvOP09xBqrcqwfdfTlveQYbvN8RKsYBvLykc+M7YCVi7Lz1n3EhVgiZQmofqGSlzZD1lBpQS3FwsRaZnT+fu5/Sqf2toAWBS7PoEQ7haqtSDoJI2nPWE5Mko/MQ1BlG4SFVX5lxUtDC0s7dRE68zS0sS5gsvOpRjV+18kGLFzC4TUl45zVwwyHa0Tivnk1J+vcB0WQf0JHvejWduWfw65sdx+SAx4pDcUqn/Q/m5i/XNnJS03lYEVAG/fPN9Sf5BT0PV6I9Jpz4YadXDP/M92ej4u8/9pdpTAXFRVsElgZx7PqdBFPqSdmIb6v47xVVUYVmjmztS9msgvr5XxLAW1LFlijNEaOkClmhhFZW9NTtIFAFY71nSqnhBnrf4yy3+NF+wBxYOmlSaNx95B0kqvdyPLZ+ysMsDNU8j5/tSBqbZVcJBJYFLPQmW+uM2VnpRAi5nottR4dDr+0tbx7sycVCVJa2HF7Cffmd/d4AOuUVcShg1o/pv1008YBZGBWrPjCqDPT1dcXlfsnu65ClwiKf4sJCYgAhStxjqPUO7EczQNRRXLzWqukB1juSWzB4zF5fjZOeWNPONDKnqttOclNUCIIZdUwTbK+f8VpqlV1nWfR6XSWCn1sofwiTptTMw4UHmFIDe3cVwgY5ugZkA4ZeJAXsF60jn5dDQ/sPuHNfoh0QmfCGfiBOGjpoT97Sg6mKcnHKxdoRUARiws1i4a1CiA127v6UzuC87DHSy10j3BGVhr5Q= 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 2024/1/9 0:25, Alexander Duyck wrote: > On Mon, Jan 8, 2024 at 12:59 AM Yunsheng Lin wrote: ... > >>> >>> 2. By starting at the end and working toward zero we can use built in >>> functionality of the CPU to only have to check and see if our result >>> would be signed rather than having to load two registers with the >>> values and then compare them which saves us a few cycles. In addition >>> it saves us from having to read both the size and the offset for every >>> page. >> >> I suppose the above is ok if we only use the page_frag_alloc*() API to >> allocate memory for skb->data, not for the frag in skb_shinfo(), as by >> starting at the end and working toward zero, it means we can not do skb >> coalescing. >> >> As page_frag_alloc*() is returning va now, I am assuming most of users >> is using the API for skb->data, I guess it is ok to drop this patch for >> now. >> >> If we allow page_frag_alloc*() to return struct page, we might need this >> patch to enable coalescing. > > I would argue this is not the interface for enabling coalescing. This > is one of the reasons why this is implemented the way it is. When you > are aligning fragments you aren't going to be able to coalesce the > frames anyway as the alignment would push the fragments apart. It seems the alignment requirement is the same for the same user of a page_frag instance, so the aligning does not seem to be a problem for coalescing? > . >