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 B5CBCC282D1 for ; Thu, 6 Mar 2025 11:43:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0254D280003; Thu, 6 Mar 2025 06:43:33 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id F1765280001; Thu, 6 Mar 2025 06:43:32 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DB6B0280003; Thu, 6 Mar 2025 06:43:32 -0500 (EST) 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 BA1DF280001 for ; Thu, 6 Mar 2025 06:43:32 -0500 (EST) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id A3BDA16152D for ; Thu, 6 Mar 2025 11:43:33 +0000 (UTC) X-FDA: 83190941106.29.5041D99 Received: from szxga05-in.huawei.com (szxga05-in.huawei.com [45.249.212.191]) by imf03.hostedemail.com (Postfix) with ESMTP id 793A72000A for ; Thu, 6 Mar 2025 11:43:30 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf03.hostedemail.com: domain of linyunsheng@huawei.com designates 45.249.212.191 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=1741261411; 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=DoX120ZqI8h9bKIJpKIkQfdkPAWLCpWz+Nri6rGXftE=; b=L7AciJPnv7IoGAbZx057AAROtkjYp8N/ZiNv+wcd4vOgp5N4f02Usq6QmrkCobxu1KrmlK hyxjDvpP0RZOoXr566D11QmwkDLctY4HlCe0VENHqqxZagCq6nHedyh81Uz1CxKoBiy7uw 1ZaEr5xnYbddGQkw/2h/wxEoqaXpld4= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1741261411; a=rsa-sha256; cv=none; b=HJS3z8witHulWenqs5N37YH0cmg52Y9WqFzCdFJLLU71/OxbAciY3e31Vf6wFN3q4syrrh 9CWuuNSLSSFsNl0pzUk3RUdru8qBQbRwl+bOuhHGttRThvJ+psiqZbvnLMd1liqN/DNf5N GlSQuE83N03KXLSllwVeRiLGEC8Nsrs= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf03.hostedemail.com: domain of linyunsheng@huawei.com designates 45.249.212.191 as permitted sender) smtp.mailfrom=linyunsheng@huawei.com Received: from mail.maildlp.com (unknown [172.19.88.214]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4Z7nZM3B73z1R5yB; Thu, 6 Mar 2025 19:41:47 +0800 (CST) Received: from dggpemf200006.china.huawei.com (unknown [7.185.36.61]) by mail.maildlp.com (Postfix) with ESMTPS id EF1211A0171; Thu, 6 Mar 2025 19:43:25 +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; Thu, 6 Mar 2025 19:43:23 +0800 Message-ID: Date: Thu, 6 Mar 2025 19:43:22 +0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2] mm: alloc_pages_bulk: remove assumption of populating only NULL elements To: NeilBrown CC: Qu Wenruo , Yishai Hadas , Jason Gunthorpe , Shameer Kolothum , Kevin Tian , Alex Williamson , Chris Mason , Josef Bacik , David Sterba , Gao Xiang , Chao Yu , Yue Hu , Jeffle Xu , Sandeep Dhavale , Carlos Maiolino , "Darrick J. Wong" , Andrew Morton , Jesper Dangaard Brouer , Ilias Apalodimas , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Trond Myklebust , Anna Schumaker , Chuck Lever , Jeff Layton , Olga Kornievskaia , Dai Ngo , Tom Talpey , Luiz Capitulino , Mel Gorman , Dave Chinner , , , , , , , , , References: <> <18c68e7a-88c9-49d1-8ff8-17c63bcc44f4@huawei.com> <174121808436.33508.1242845473359255682@noble.neil.brown.name> Content-Language: en-US From: Yunsheng Lin In-Reply-To: <174121808436.33508.1242845473359255682@noble.neil.brown.name> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit 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: rspam02 X-Stat-Signature: qg8unw75578xq4mt7zi1mt5spyt4h8fr X-Rspamd-Queue-Id: 793A72000A X-Rspam-User: X-HE-Tag: 1741261410-780905 X-HE-Meta: U2FsdGVkX1+lC7nqkm/UZI6+vnNvA8W7r2KMRpluxieKrvtZYDZh4ocdrqTDAtzZBBGekA5SCHpppQWlWOcWaVHFZ46FZGsMPG2HgI+H0tk2skeet22xo7Do4y5L3pINq9dq9EwAbFmt375Gy1Cj+/AFqGTkIeGlqlVEqByqFZFvmodaIGB4jBXDFDOeK8Ut4E62JwalPLyDsN7IK+DYZ4TL9hhjaWOEjy6SVi7pw8Jb1PIRszJ98Vs/cWKkApY/L/faKmH6ZKJqV6WE9VU+hWv5N+8G3Btz96qesfxCc3wsAdTwK+ZhTtQWZPXSPJV9UeJuEvU5pg8T5WlWI5BHCH5wCx2E/3TgLoTr7Zc4bo85mfUPNSxPyXRFfB/suD4ywr+3VMu7Y4z47TR/mU/2EUXk/g9MZKx4fNt46/Vg4hLC55dWxF9JeWW/OOi3j0qhvY9TEQR3JoB0+i3BIp/EtJYB93bke3dD8dRs+houLARoMWSBu4J4mutIX1SA/kW/FDu7kmF4LSYWZL6rRSxOXoZobG55tWNAS6FQQ2UCSHk9/69MvWjGrYuP8aq5E8ZVoW7lQr/yE7smtv/7PDlF76I6AMfpvufhX5JbumzJTGZ4xWF414xsqrfScPGJjtqUidApdxl06aYQ+9iFE6pnYufwPKUxRk/QjiywQSHrAtrO3upf9d/Ae6SfivSmkdWdH/M/PtsGnxR65/Yww6IjQtQQ+9uu6Xc1yGxS6woOXw8AGIpG8K4cRRmi61VnzOaRau/fQ14JxbWo/RYzfvjVFwsDjswHPBK9/qVf2AIBJeoD8d2K6ZEiDoZ9ELXAqlafLIRwaLRLWPlH0ziaECXZN/5rjs1150GW5haTQtNQH+iM4crVXASDx+Xrl6gtcOmJfQ+JLWBQ1xU30pSABzpAfEJkQh/9gmzAK44Z+iF0Zhi7i3tAM/AVcVQg61HLjJZ5STd2YtIs2iPTNbktzFG O3ZO5FsV AfJrQKCJ6BPQUVuIg5ZYRni1f15vwfFywc968J9qb7M59+XJT8ZI9ovluOzETJigb9mA2GNg0lRK9xH7/SXdhFjrLC/OQ/8vmgwNq+Qw5zfn4scn8O8+/EEUvur0O4GQoYz8QrCV4hHovGEe4TaoFIWALjuTJzNui3uq7oLLpjj8ISxh9N0rpNPcl4I+q1R7FHdKdC33POSb6xIUjAFs+XlXNJR7Th+MZUIcHcjt5yzlDWuA= 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 2025/3/6 7:41, NeilBrown wrote: > On Wed, 05 Mar 2025, Yunsheng Lin wrote: >> >> For the existing btrfs and sunrpc case, I am agreed that there >> might be valid use cases too, we just need to discuss how to >> meet the requirements of different use cases using simpler, more >> unified and effective APIs. > > We don't need "more unified". What I meant about 'more unified' is how to avoid duplicated code as much as possible for two different interfaces with similar‌ functionality. The best way I tried to avoid duplicated code as much as possible is to defragment the page_array before calling the alloc_pages_bulk() for the use case of btrfs and sunrpc so that alloc_pages_bulk() can be removed of the assumption populating only NULL elements, so that the API is simpler and more efficient. > > If there are genuinely two different use cases with clearly different > needs - even if only slightly different - then it is acceptable to have > two different interfaces. Be sure to choose names which emphasise the > differences. The best name I can come up with for the use case of btrfs and sunrpc is something like alloc_pages_bulk_refill(), any better suggestion about the naming? > > Thanks, > NeilBrown