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 2FA1DC83F1F for ; Thu, 10 Jul 2025 09:57:59 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9C3076B0093; Thu, 10 Jul 2025 05:57:58 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 99B496B0096; Thu, 10 Jul 2025 05:57:58 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8D8076B0098; Thu, 10 Jul 2025 05:57:58 -0400 (EDT) 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 7EDCA6B0093 for ; Thu, 10 Jul 2025 05:57:58 -0400 (EDT) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 31F2CBA049 for ; Thu, 10 Jul 2025 09:57:58 +0000 (UTC) X-FDA: 83647903836.24.C8B7072 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf18.hostedemail.com (Postfix) with ESMTP id 85A641C000B for ; Thu, 10 Jul 2025 09:57:56 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=vNulD8l8; spf=pass (imf18.hostedemail.com: domain of dakr@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=dakr@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1752141476; 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:dkim-signature; bh=SJP4V+INAOp3lw3Sz3DCpc/LuYMz4i5EqrjlrsuvLzI=; b=wUhAtQ1ofzkUjZI4dJX3JeToAEIbXIGnwUK7s5LQOMnYz5yDIz3gEuq65ifqXUiBX8x9X6 V/+TwxOfMykqg8E1JxkyXhYeu7UHr7oV62CKDToLVI9AXmlyCTC0ECJPOjd9ZKU+JCK1xH rOH7MUwUopu1mRDeywzYLAFcf419vTg= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=vNulD8l8; spf=pass (imf18.hostedemail.com: domain of dakr@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=dakr@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1752141476; a=rsa-sha256; cv=none; b=AOO2OAYR7KbtfXxup2wDLyvBbbSEip8yVUWbSu2NL7odJX6+S1xVMN0voRweOHS/IxlhsA BZTtUnWxRexCzotywnK3zQNLT8YxubfTtigB2Pma5T8nWelCESNRfli6Cx4d8K1Szc+x+R yHKZJQdh1Xtc2KdO+SfYMSLzWelRY7U= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 674995C6C15; Thu, 10 Jul 2025 09:57:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D741BC4CEE3; Thu, 10 Jul 2025 09:57:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1752141475; bh=B5Te1MOfraVVrSpjVQqFSGNLCQuc3hLW//SrxwQmFCI=; h=Date:From:Subject:Cc:To:References:In-Reply-To:From; b=vNulD8l8X0acklVEmHYF6S8BVnK+45pS2sUQfSezAQwOQ7uZUtMKG0RIvwIuOwqVN CiszKPKYAXRasB/EQD8VLrBkthqNMWby/2oKdjxD5gv3C2g97D/FDWbfFXA+cOmhsv V9CdxRiVg110RYC6k55Kue7ZF7Jw8UKm5vV1eYgg6YOUTzYpAz86ImrNbywCl5VUkx JybQaalrWBLrVRURMZpZn74AZEnRHX61sNITP9ygx/c6s3btRxcqBOBFQCx72C0eHG AkJQlrzblaVCzMwsY0KqRuc1wbybmnyeB4ESYj/5yyiQJ+PB5XKQdGH7qHIS9aWhv9 XRKR6B3glJhWA== Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Thu, 10 Jul 2025 11:57:50 +0200 Message-Id: From: "Danilo Krummrich" Subject: Re: [PATCH v12 1/4] mm/vmalloc: allow to set node and align in vrealloc Cc: "Vitaly Wool" , "linux-mm" , "Andrew Morton" , "LKML" , "Uladzislau Rezki" , "Alice Ryhl" , "Vlastimil Babka" , "rust-for-linux" , "Lorenzo Stoakes" , "Liam R . Howlett" , "Kent Overstreet" , , "bpf" , "Herbert Xu" , "Jann Horn" , "Pedro Falcato" To: "Alexei Starovoitov" References: <20250709172345.1031907-1-vitaly.wool@konsulko.se> <20250709172416.1031970-1-vitaly.wool@konsulko.se> <14b08e7c-c2e8-435c-a1dd-bd51cfb42060@kernel.org> In-Reply-To: X-Rspamd-Queue-Id: 85A641C000B X-Stat-Signature: hrwmcc7ft4khfuim5sc8axgsib73apt5 X-Rspam-User: X-Rspamd-Server: rspam07 X-HE-Tag: 1752141476-794442 X-HE-Meta: U2FsdGVkX1+S0h/+yzjxzfTgn8JzOWvLGCoxcmkWi4oK5VLMhx64pR6Oq0ebbtg2OdzZpu+HhL5+fQSJoXJmq4Bt1NilOmRZGwL6kmdO4RJyNuKaDh2INnKIDL5LoS8ykM7zYIka8dkSlRqEbzBZi6nzkNSth3AT76FLPdByY5ZQx1UG1/wj8P7CI6WKzfdQfQaujsRGcAOxGTRlrIL/vYPduz9QOmTpSyOZyPVjDwvjtPqJ3UUY0O+4CwZM1gpQHiv8xLHL2Ijko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h1CiUz3RC1WTJOVBJC8FMA7w== 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 Thu Jul 10, 2025 at 2:39 AM CEST, Alexei Starovoitov wrote: > On Wed, Jul 9, 2025 at 4:26=E2=80=AFPM Danilo Krummrich = wrote: >> >> On Thu Jul 10, 2025 at 1:14 AM CEST, Alexei Starovoitov wrote: >> > On Wed, Jul 9, 2025 at 3:57=E2=80=AFPM Danilo Krummrich wrote: >> >> >> >> On 7/10/25 12:53 AM, Alexei Starovoitov wrote: >> >> > On Wed, Jul 9, 2025 at 10:25=E2=80=AFAM Vitaly Wool wrote: >> >> >> >> >> >> >> >> >> -void *vrealloc_noprof(const void *p, size_t size, gfp_t flags) >> >> >> +void *vrealloc_node_align_noprof(const void *p, size_t size, unsi= gned long align, >> >> >> + gfp_t flags, int node) >> >> >> { >> >> > >> >> > imo this is a silly pattern to rename functions because they >> >> > got new arguments. >> >> > The names of the args are clear enough "align" and "node". >> >> > I see no point in adding the same suffixes to a function name. >> >> > In the future this function will receive another argument and >> >> > the function would be renamed again?! >> >> > "_noprof" suffix makes sense, since it's there for alloc_hooks, >> >> > but "_node_align_" is unnecessary. >> >> >> >> Do you have an alternative proposal given that we also have vrealloc(= ) and >> >> vrealloc_node()? >> > >> > vrealloc_node()?! There is no such thing in the tree. >> > There are various k[zm]alloc_node() which are artifacts of the past >> > when NUMA just appeared and people cared about CONFIG_NUMA vs not. >> > Nowadays NUMA is everywhere and any new code must support NUMA >> > from the start. Hence no point in carrying old baggage and obsolete na= mes. >> >> This patch adds it; do you suggest to redefine vrealloc_noprof() to take= align >> and nid? If we don't mind being inconsistent with krealloc_noprof() and >> kvrealloc_noprof() that's fine I guess. >> >> FWIW, I prefer consistency. > > What inconsistency are you talking about? That > krealloc_noprof(const void *p, size_t new_size, gfp_t flags) > and > vrealloc_noprof(const void *p, size_t size, unsigned long align, > gfp_t flags, int node) > have different number of arguments?! > > See: > alloc_pages_noprof(gfp_t gfp, unsigned int order); > __alloc_pages_noprof(gfp_t gfp, unsigned int order, int preferred_nid, > nodemask_t *nodemask); > > Adding double underscore to keep all existing callers of > vrealloc_noprof() without changes and do: > > vrealloc_noprof(const void *p, size_t size, gfp_t flags); > __vrealloc_noprof(const void *p, size_t size, unsigned long align, > gfp_t flags, int node); > > is fine and consistent with how things were done in the past, > but adding "_node_align_" to the function name and code churn to all > callsites is a cargo cult. As Vitaly mentioned in a different reply, this would be inconsistent with t= he 'k' and 'kv' variants, which have the suffix '_node'. Anyways, in general I don't think that adding underscores for functions tha= t basically do the same thing but are getting more specialized is a great pat= tern for things that are not strictly limited to a narrow context. Please note, I'm not saying we should encode additional arguments in the na= me either. I think it really depends on the actual case. In this case, it seems to make sense to me that there is e.g. kmalloc() and kmalloc_node(). For a caller that's much more useful, i.e. I want classic kmalloc(), but wa= nt to set the node, hence kmalloc_node(). Calling it __kmalloc() instead seems a = bit random. Or do you only refer to the *_noprof() variants, which are not exported to users? But even then, underscores still don't seem very expressive. I'm not maintaining this code though, so just take it FWIW. :)