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 EC627CFC288 for ; Tue, 15 Oct 2024 10:58:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 867036B0083; Tue, 15 Oct 2024 06:58:47 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 818076B0088; Tue, 15 Oct 2024 06:58:47 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 706576B0089; Tue, 15 Oct 2024 06:58:47 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 51AEB6B0083 for ; Tue, 15 Oct 2024 06:58:47 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 50D9E1614BB for ; Tue, 15 Oct 2024 10:58:37 +0000 (UTC) X-FDA: 82675538526.18.56BEDFB Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf10.hostedemail.com (Postfix) with ESMTP id 44417C000C for ; Tue, 15 Oct 2024 10:58:40 +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-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1728989767; 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=uSHZTB0oadqVpWmzXmiU4FdPnhaCj2UrK88UVYos1Xo=; b=L8SlVxEoa9oKErgmpKHJ3F4orDUd8pRvhW5zORc157XUiNt1eiKxMZ7mEFw+9wXex77vrx CHv8LfFNIO5h1pJD5hkZL12DFdi4v6OCpCfizjuQPDpywH2sMYw13zLb3s1sA+sXu0mf0O kovQfPquE0bAQ4OnCXyUk2XOzLW3E8k= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1728989767; a=rsa-sha256; cv=none; b=JY9JvM+xF/gnTadmz+YnhNQmHbruo0KKvIQiXLXKtAn5uRXOdEYnrMi3jc7GztB+FQEowd WnjyWmFtDelpgRL+nwftB+TdVQ3e7/3tr9bxHdtxiwFx1thL0FXpkhTFBPzdGc/ccHn63I inkeMfXtkmet/bCZvJWMU5OCdrVvBKE= 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 Received: from mail.maildlp.com (unknown [172.19.163.252]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4XSWJY5zD0zySdf; Tue, 15 Oct 2024 18:57:17 +0800 (CST) Received: from dggpemf200006.china.huawei.com (unknown [7.185.36.61]) by mail.maildlp.com (Postfix) with ESMTPS id A66D1180AE9; Tue, 15 Oct 2024 18:58:40 +0800 (CST) Received: from [10.67.120.129] (10.67.120.129) by dggpemf200006.china.huawei.com (7.185.36.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Tue, 15 Oct 2024 18:58:40 +0800 Message-ID: Date: Tue, 15 Oct 2024 18:58:39 +0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH net-next v21 13/14] mm: page_frag: update documentation for page_frag To: Bagas Sanjaya , , , CC: Linux Networking , Linux Kernel Mailing List , Alexander Duyck , Jonathan Corbet , Andrew Morton , Linux Memory Management List , Linux Documentation References: <20241012112320.2503906-1-linyunsheng@huawei.com> <20241012112320.2503906-14-linyunsheng@huawei.com> Content-Language: en-US From: Yunsheng Lin In-Reply-To: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.67.120.129] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpemf200006.china.huawei.com (7.185.36.61) X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 44417C000C X-Stat-Signature: ppczorzjr9n64f4roqcsno1f1pqq81y5 X-Rspam-User: X-HE-Tag: 1728989920-130231 X-HE-Meta: U2FsdGVkX1/ROlD+l3YUX7No5Ym1B+VFxsg8g0m867QMcZIu+bfgVMaJLkDI73cug7ClOGtfJXHDLPaCbE42B47or8YrP8CsaYktd3MPjbjzzkqywq0eVNxXdEnZpu07fFSpD0gEJMdZSdLzrFxRsn9gczOqY+YSUpMTPo92tAedM62guD/LlA6zB+yorCGuuzCpDOpC9XrRSjNjALjNaY0wczlE/2GtpSwggZnfWWHGyNORtOKx7WaiFBJ9ni3uLsbg0BFaS+Qw1/fiTaxE7JS/kXtiAC3Yuc2DDnz48ZTRjyqCBUNgzkTMZA92DZSow96mz2bvspnQheV90fgK/XBifrt1WS5Ps3HenpwuXlFItrTrSYqenE5mDnZJ1rn2nwP7Sy/4Gp1pI6qEitghuhyIEPWSB7sBYyh+bfHyak+rxUjIpa1rtXtg7L37FQx85WXpsEA8RtPTWETEFtlyKgGbywNVc4n6Hj3aEug6lD8a3+Aor1gniwwJgdo0wYuKaXGaWUs1SDa/PCXUMy9ipuWeW5FmMFk6areGhODLNa1/9HrvF8qJpyiAegCxJFGYNkAAN8GqHTUnEkbmfem3OIIolDLJExM7Xx6otYaY7UA3yFoEpWush0SKjR2BewYqiNUSQUFivz92Mai06k6Lt0oo4HRe6u3jbFqS0h6RcorwIFBQEOIyFBQgzlW8mJuaHNCIW43JsS+2Wj/e5icN8tLs4yx86HHzJEDdr9nLn71zm+rnmBXxwRBxwafIeabfwl6tLjAtRGXeuRcVdyKoBWTA1XOSVdz5B5+7Bki9KZabF52ZA7/0Qf2wnl7mJ1g1vy49JeK4/Gpa6RVUwhcnkLPSWrjAcsk+r0rYrEezJ0TSJpucs2J9T582eGMD5sMRIFJNW/TGvZD0ayTWq4MBfEaWKi+CNe452cOQAOD9wfoJqeSvzJRhqAcW0XzbXGwbVlgrCai54jaqDAcmkkg tFzqC7o3 uAEPN7Ri7esumi4Mk5Bcia6JWPA22M/NZsLL+eZ8h0OTxuOg1eFRoRBTbX+XPDSK7IvK6TMkfg4KKv0IwG4uzhZUXhWMuxQbYu6RHRgttcClbWS1SJ2PNzSaIjcZmKj1Or17tFSnJDVDyHg80ktLe6wJI6cO1BTVaz/E5p4/2ExxIH1fs6UH1IiYeg3mSLGs6pVzKkaVzYI2segyIi/t46EfN1YKCaNUVFcqSPrplmHMGTY7I3msb56YqORXbsSv7zyw5Zo60xouTmmsG0Ytgh1EJbFHjZZEeF6A3GzIWJGxZr/3Nyt/EgtTyKswbnegUkGykHFLr+vHBPr2hHr5xEmrWTkGvdqE3XuYK 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/10/15 13:20, Bagas Sanjaya wrote: ... >> >> +/** >> + * page_frag_cache_is_pfmemalloc() - Check for pfmemalloc. >> + * @nc: page_frag cache from which to check >> + * >> + * Used to check if the current page in page_frag cache is pfmemalloc'ed. > is allocated by pfmemalloc()? There seems to be no pfmemalloc() function. Perhaps change it to something like below as the comment in page_is_pfmemalloc(): Used to check if the current page in page_frag cache is allocated from the pfmemalloc reserves. >> + * It has the same calling context expectation as the alloc API. >> + * >> + * Return: >> + * true if the current page in page_frag cache is pfmemalloc'ed, otherwise >> + * return false. >> + */ >> static inline bool page_frag_cache_is_pfmemalloc(struct page_frag_cache *nc) >> { >> return encoded_page_decode_pfmemalloc(nc->encoded_page); >> } >> >> +/** >> + * page_frag_cache_page_offset() - Return the current page fragment's offset. >> + * @nc: page_frag cache from which to check >> + * >> + * The API is only used in net/sched/em_meta.c for historical reason, do not use >> + * it for new caller unless there is a strong reason. > > Then what does page_frag_cache_page_offset() do then? It is used to replace the the below direct access of 'page_frag_cache': https://elixir.bootlin.com/linux/v6.11/source/net/sched/em_meta.c#L585 Each one of 'page_frag_cache' instance has its own allocation context to ensure lockless access, it is not encouraged to access 'page_frag_cache' directly outside of the allocation context as the accessing is unreliable.