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 31A8BE7718F for ; Fri, 3 Jan 2025 11:22:06 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BE9EE6B007B; Fri, 3 Jan 2025 06:22:05 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id B99E26B0083; Fri, 3 Jan 2025 06:22:05 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A61A86B0085; Fri, 3 Jan 2025 06:22:05 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 874416B007B for ; Fri, 3 Jan 2025 06:22:05 -0500 (EST) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 3E4A7120724 for ; Fri, 3 Jan 2025 11:22:05 +0000 (UTC) X-FDA: 82965899856.26.6DAE671 Received: from szxga06-in.huawei.com (szxga06-in.huawei.com [45.249.212.32]) by imf05.hostedemail.com (Postfix) with ESMTP id AD1FF100010 for ; Fri, 3 Jan 2025 11:20:23 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf05.hostedemail.com: domain of linyunsheng@huawei.com designates 45.249.212.32 as permitted sender) smtp.mailfrom=linyunsheng@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1735903299; a=rsa-sha256; cv=none; b=G5MqbuZbJZ9UPGTv7tzf/CqEh6//1q+E2iP5TUB2CCy9H8G8lgs27WvTatLuJwc3Fp0wi3 2Q0E75MQRmTeN7TGz7pT9t6awDcvI5mwddFPB9BwUv9Q03hJ8zXaDVmvNItLkFJmp6tQ6p L2/rZaMdLnZCfKj5zm4WIyjrloezWB0= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf05.hostedemail.com: domain of linyunsheng@huawei.com designates 45.249.212.32 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=1735903299; 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=NcOeVBaITbxrc4+B75LKYLIEn37/Hn1+LknYX3R8SRY=; b=Xhj3tPSP+0RQHKoODXi1V8RVV9rB6W7lsAGkkQ2vamWUJYI4FxxasQ6MJvJb9Y3CV++Gul 7i9u49OVY+6unhJmimB3ddMl2NCUYxD7QntxSafuuF/JDx0SpQxhAyhckcgrTrLjxHL1VX GDG7QPn7vyNRI8jMc5rmaDsF0/GBqyk= Received: from mail.maildlp.com (unknown [172.19.163.44]) by szxga06-in.huawei.com (SkyGuard) with ESMTP id 4YPh4X3sGVz20nM2; Fri, 3 Jan 2025 19:22:20 +0800 (CST) Received: from dggpemf200006.china.huawei.com (unknown [7.185.36.61]) by mail.maildlp.com (Postfix) with ESMTPS id CD47B1402DA; Fri, 3 Jan 2025 19:21:58 +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; Fri, 3 Jan 2025 19:21:58 +0800 Message-ID: <0edbfcf5-db26-441f-ae9c-f85985cb8b68@huawei.com> Date: Fri, 3 Jan 2025 19:21:58 +0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 1/2] mm: alloc_pages_bulk_noprof: drop page_list argument To: Luiz Capitulino , , , CC: , , References: Content-Language: en-US From: Yunsheng Lin In-Reply-To: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-Originating-IP: [10.67.120.129] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggpemf200006.china.huawei.com (7.185.36.61) X-Rspam-User: X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: AD1FF100010 X-Stat-Signature: fmub5j5scwkaoha5wbrq4pyr5sc6u4mw X-HE-Tag: 1735903223-204368 X-HE-Meta: U2FsdGVkX1+O71VwCRx3uIpCFfgpNVXvghAXXlb4LKdfimgPVr4mr2LLfd0480ZPKeBUKF/4G1ytSNRiDAqsxuiAa0flJZ3QqKEm2NYmpwOEmCs4GCU0JGnND1WTCgwTMp6R82We0BTx7U3/EGMr3Jnf4DFMGMNyGmFq6B25p6LYbTBRwqgvaI4jCLYqzXZTkE/7RXTcOM+8rcKzFLbpDCrJ3da9TaFfbNbxZq0jigCU2VTQyRBt3jeFqwjRkqMXr+TCaa6BdTijrvDLqKC3RwBzHUXCLUU6KkLqGbWJ7t+rTvCn5Y44WwoGmk3uVwR4hVO62WHX/M+UQkmTS/eJUV8Upm3DRyCAH5Is2okMaq/MCNSY9j9HlDMdaSK/ri/sGy7IF/p33jtee243MYwjxJfyI0OSiKhV668l3Qpuf4q97CyScEw/GyT004H7YcnL2uU5vx6SPT2ZZnwQ9F4IW7eKUn/losSY1XL25DktXnx/6ytrfu0Tv64E175qBEZ2ZmjW8SK3h1LQlT2y3fg6jvHVoFPCWQ4PCUXgUl9xfEx3m0A4Bg/47WzcNWB/2uriYh/9lAmMZcjFDTUE6rbXcem4cmD/3vdigzfJssB/6mihtuzyxzbHbj8HlaxsuDCEeec9J+BEey0fYUziEhmAMK7TTowUZgqkYLcnlmEnvapOrxDuI/xTvgKoJIHqHS9QN6NFnkhqvfio/C9hByvrCpftxrZtXlM/16k3F63IdLEHnTMuZxc02D27l5vFzpSsnngrHp4FE9UI3lRDRyUjkGN7F8+ny6qzSSjMKf3MR9Ewx4LySmKnY9lxPVZvLpZ9xUux7VELU2zL+Pt/e0TqpVjhyxR28/e7q/Gso8z4a4cm8ch2Q7qQzwK070/ncUbuKxgkglEBM9WggBAcaQzikGwAo6d2I9iDQXMj52UDEfU6X1OKmjJ4eHITK/siAE9jkfXXPuSdC79GnI7eDlm JItviw+p AseBXuBrixZUbv989Ssf4wJC9yGPmtME6/zMiDjr5IFCqY9uuC4n7ttSAjnagzo9kZOrkl9ySn4OubNmhBqJy+g7cnujaK2sZ7gG/XE+VCcsYr5uGSAGWYVhhyWyAv/KCLFq8VrAWE2HcALMVlmrBlhRobp83B+rKpy4/gMjoWU/jAdWSLM22rmpuzQLCnHd5lEru4h8cTsnLL5Zl5HRI9EcjjP47EjTcxJxh6R8CJo6cSCo= 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/1/3 0:38, Luiz Capitulino wrote: > On 2024-12-25 07:36, Yunsheng Lin wrote: >> On 2024/12/24 6:00, Luiz Capitulino wrote: >> >>>   /* >>> - * __alloc_pages_bulk - Allocate a number of order-0 pages to a list or array >>> + * __alloc_pages_bulk - Allocate a number of order-0 pages to an array >>>    * @gfp: GFP flags for the allocation >>>    * @preferred_nid: The preferred NUMA node ID to allocate from >>>    * @nodemask: Set of nodes to allocate from, may be NULL >>> - * @nr_pages: The number of pages desired on the list or array >>> - * @page_list: Optional list to store the allocated pages >>> - * @page_array: Optional array to store the pages >>> + * @nr_pages: The number of pages desired in the array >>> + * @page_array: Array to store the pages >>>    * >>>    * This is a batched version of the page allocator that attempts to >>> - * allocate nr_pages quickly. Pages are added to page_list if page_list >>> - * is not NULL, otherwise it is assumed that the page_array is valid. >>> + * allocate nr_pages quickly. Pages are added to the page_array. >>>    * >>> - * For lists, nr_pages is the number of pages that should be allocated. >>> - * >>> - * For arrays, only NULL elements are populated with pages and nr_pages >>> + * Note that only NULL elements are populated with pages and nr_pages >> >> It is not really related to this patch, but while we are at this, the above >> seems like an odd behavior. By roughly looking at all the callers of that >> API, it seems like only the below callers rely on that? >> fs/erofs/zutil.c: z_erofs_gbuf_growsize() >> fs/xfs/xfs_buf.c: xfs_buf_alloc_pages() >> >> It seems it is quite straight forward to change the above callers to not >> rely on the above behavior, and we might be able to avoid more checking >> by removing the above behavior? > > Hi Yunsheng, > > Assuming the use-case is valid, I think we might want to keep common code > in the API vs. duplicating it in callers? I was thinking maybe adding a wrapper/helper around the __alloc_pages_bulk() to avoid the overhead for other usecase and make the semantics more obvious if it is an valid use-case. > > In any case, even if we decide to go for your suggestion, I'd prefer not > to grow the scope of this series since this could delay its inclusion. > Dropping the list-API (and dead code) is actually important so IMHO it > should go in first. Sure. >