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 794A8C25B10 for ; Fri, 10 May 2024 09:49:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1218D6B00AC; Fri, 10 May 2024 05:49:02 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0CAE76B00AD; Fri, 10 May 2024 05:49:02 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F22836B00AE; Fri, 10 May 2024 05:49:01 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id CA4A06B00AC for ; Fri, 10 May 2024 05:49:01 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 79D5D1A0EF9 for ; Fri, 10 May 2024 09:49:01 +0000 (UTC) X-FDA: 82102012482.05.B79C84F Received: from szxga04-in.huawei.com (szxga04-in.huawei.com [45.249.212.190]) by imf04.hostedemail.com (Postfix) with ESMTP id 302AE4000A for ; Fri, 10 May 2024 09:48:58 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf04.hostedemail.com: domain of linyunsheng@huawei.com designates 45.249.212.190 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=1715334539; 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=HZglq+uRNrqK5aOQeYZ19NdNoml3CJb/xehER9ozN/k=; b=m/0zGDHMgXwYCbUaCJDxe6HKtexU8oY4x9xYmUcRDnUBwdkfGwR/JlkrUH3VObvYJoP2QL otMMtCKcviBwaCFFRBO+ViPj2H6abU3pHJAbw7BG2pVqrmCx1AMCt+M7ccbI9izH7xnQNX MaPzbN+XffZFo/ikQJsIkKbGGkwnSHw= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf04.hostedemail.com: domain of linyunsheng@huawei.com designates 45.249.212.190 as permitted sender) smtp.mailfrom=linyunsheng@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1715334539; a=rsa-sha256; cv=none; b=YYPA3+QURs+zWaNyyLVSgBh7UWAW9HABSGuM1xbxslq50/8Y/bFnjcmbwJzYzPCB3PgRyz Lw9Ave0uGjT7TfL9pYJy9775pFt+B4nPu1H4VKdbKXH8NSXEiaLp8Q7ssL31SGqMQKn5ro U8/c+KvbLm3P5YsGeWDCJr5Ye1cqnT8= Received: from mail.maildlp.com (unknown [172.19.162.112]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4VbPCM1tQ1z1ypGw; Fri, 10 May 2024 17:46:07 +0800 (CST) Received: from dggpemm500005.china.huawei.com (unknown [7.185.36.74]) by mail.maildlp.com (Postfix) with ESMTPS id B24CF14038F; Fri, 10 May 2024 17:48:55 +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_256_GCM_SHA384) id 15.1.2507.35; Fri, 10 May 2024 17:48:55 +0800 Subject: Re: [PATCH net-next v3 12/13] mm: page_frag: update documentation for page_frag To: Mat Martineau CC: , , , , , Alexander Duyck , Jonathan Corbet , Andrew Morton , , References: <20240508133408.54708-1-linyunsheng@huawei.com> <20240508133408.54708-13-linyunsheng@huawei.com> <2dc46fd0-fe7a-436a-5238-ff6b3f69e1a8@kernel.org> From: Yunsheng Lin Message-ID: <9b76e7c0-7b24-00e5-adba-214ce306ae96@huawei.com> Date: Fri, 10 May 2024 17:48:55 +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: <2dc46fd0-fe7a-436a-5238-ff6b3f69e1a8@kernel.org> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.69.30.204] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggpemm500005.china.huawei.com (7.185.36.74) X-Rspam-User: X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 302AE4000A X-Stat-Signature: 911f646bsdjr357e6zqhq4czb53yktd9 X-HE-Tag: 1715334538-451137 X-HE-Meta: U2FsdGVkX181xyApI32daAPfeq1SjgWgjKgoYpQnMP9lpRlAfooVIpIhYQX/xhItInNIzYdHhd4aEnkixCw9RkPAw7aUhJOfk+VCM7ddgRQKFLNILKGUvWfqOhgYklkDALUhkJTPsEjD5nUJvRZQzl2HJplpViZphELVdrl+lc9yCOUC/oUkBnDFCOZUiULw7zFjWCy8qaZRWIIIbKLWNndfZ7zRQlTjJFuM1/iTcI0Du+N11GIEIl88NGD3TjslIgOsFWWYpFrCrRihkdZL1jHaGhr6tupWZE4ESbzJbivs8tz6tffTVbrThZEvuZYGyq7y/Vd1SRxsCqNxWUpytqse9FpYiWfinNy+MQ+BUbGHx72/ViBxBKk21Eh/UDq8RHDkYQYslZHAEiQFP70Qleulw6A5LIyTNlt/NDKP8D2cCjRsAGQJcmCjeOy3YVIjzSa8h7ctr7ar/GtOO+AdgynuwgYAGw24pTCnQGg90nBxUHrLwv/vUv/KFJSTilvL/1GBA+dwEOsr8eQOck4CApbXif++ECGrrx70CkrLc9cPUhoz3z+ZJpkmzk5nh9I6pyXct05mOBUW8v1iupiEY+cAVnjhcAFlqB1MwLYg2iKz5HNc+eK+U4W0XAo5biC09tYHcu+gJwmI3cT+EoQu0eieV9HqbeyL0jYgMCwln6lSqnP9gSmBHHeVRVMnyVy/XIGkZuxrXjTu5pThsNqWlcMSx4SdHrTRe9eii/56jliEmE84KLKQEfsHsM3uXVjuw6YyQmNRzUbQs1AZ41xyTZQHdq6zwsCtNMw5t6lkSnY2svAUxZXUF87iWjWDVExmq7eYDr+DXHx5qxHZiUoz5EAMOvEp+6NYeYCkRiHC66/PxB4IcXzPodPX4nWEVAIJWok7aECQOJ6NnKq9ajiZW8wbfTGC16oKkIUHN+MprF90XLcU93wBfCunxSCxXKV/bigg1KpIpeTv6thadf/ EdwhlYhV YycVrtnlw5ElJ3l1dD6WgMxXvpuP3VQttYWNo4ew43YRIhGElLruGmt4uZ9W3pczAQ6ZhPNZQ33rIcaD2XqPGBQonKXLbZB5lcJlET+kXyvmyj9QCG5olKPo2yIvV6WhC3g5uWtyGi0pKT5WobEEYcnvaqo2JZtstjHy8E3pZwXmXK3iUsqaToHieTvv6iMcMJfjbRph+LBQ92CpmGDuod/tBGCApUPWSdnQWydJMB+J995nwitUvpYpNHNNfx78ultPD 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/5/10 0:58, Mat Martineau wrote: ... >> >> +/** >> + * page_frag_alloc_probe - Probe the avaiable page fragment. >> + * @nc: page_frag cache from which to probe >> + * @offset: out as the offset of the page fragment >> + * @fragsz: in as the requested size, out as the available size > > Hi Yunsheng - > > fragsz is never used as an input in this function. I think it would be good to make the code consistent with this documentation by checking that *fragsz <= (nc)->remaining Yes, you are right. It is not used as input, will update the documentation according. > >> + * @va: out as the virtual address of the returned page fragment >> + * >> + * Probe the current available memory to caller without doing cache refilling. >> + * If the cache is empty, return NULL. > > Instead of this line, is it more accurate to say "if no space is available in the page_frag cache, return NULL" ? > > I also suggest adding some documentation here like: > > "If the requested space is available, up to fragsz bytes may be added to the fragment using page_frag_alloc_commit()". Ok. > >> + * >> + * Return: >> + * Return the page fragment, otherwise return NULL. >> + */ >> #define page_frag_alloc_probe(nc, offset, fragsz, va) \ >> ({ \ >> struct encoded_va *__encoded_va; \ >> @@ -162,6 +241,13 @@ static inline struct encoded_va *__page_frag_alloc_probe(struct page_frag_cache >> __page; \ >> }) >> >> +/** >> + * page_frag_alloc_commit - Commit allocing a page fragment. >> + * @nc: page_frag cache from which to commit >> + * @fragsz: size of the page fragment has been used >> + * >> + * Commit the alloc preparing by passing the actual used size. > > Rephrasing suggestion: > > "Commit the actual used size for the allocation that was either prepared or probed" Ok. Thanks. > > > Thanks, > > Mat >