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 373BEC77B7F for ; Fri, 27 Jun 2025 22:15:13 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6D73D6B00A1; Fri, 27 Jun 2025 18:15:12 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 687906B00A4; Fri, 27 Jun 2025 18:15:12 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 576036B00A8; Fri, 27 Jun 2025 18:15:12 -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 459236B00A1 for ; Fri, 27 Jun 2025 18:15:12 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id A1AFEC03CB for ; Fri, 27 Jun 2025 22:15:11 +0000 (UTC) X-FDA: 83602587222.27.62D0C23 Received: from mailrelay-egress12.pub.mailoutpod2-cph3.one.com (mailrelay-egress12.pub.mailoutpod2-cph3.one.com [46.30.211.187]) by imf24.hostedemail.com (Postfix) with ESMTP id 762F918000A for ; Fri, 27 Jun 2025 22:15:09 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=konsulko.se header.s=rsa1 header.b=oSMqxT3m; dkim=pass header.d=konsulko.se header.s=ed1 header.b=bYyN+5qo ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1751062509; 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=T13rm+wv6m7Nf4D6++TT2JCiBV05mPjobL0Tfcq7go4=; b=qTaZZXXzpvAgqJMA1PSaIYHVa33elIDD7TN0vRznRHNfCQJmAUx4q0MOvILqEPbpHqB8VQ Sc1V9DmIHBc1hA4xIMqsNV6/gf6N9KLpatAVw7EXXoe134yG/FNvsR7tfVQRCmjv8gFmzx N+5YvGQQeyeby6QcMIEFnjujsacfEQ4= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=konsulko.se header.s=rsa1 header.b=oSMqxT3m; dkim=pass header.d=konsulko.se header.s=ed1 header.b=bYyN+5qo; spf=none (imf24.hostedemail.com: domain of vitaly.wool@konsulko.se has no SPF policy when checking 46.30.211.187) smtp.mailfrom=vitaly.wool@konsulko.se; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1751062509; a=rsa-sha256; cv=none; b=CeMthCKh6Jsh8KB2TAyP0oP4EzSCr3AF5jRLMcGjLprL5fUJmzHOXcjmRTaiFb3wcmxE8G gCV1fawPYwQxvdnshSVxrkXOi64asHv0Vtp5flWKCY+6/9ZeDoWapx8YxgR8V94Jck5YdW UyVMCNS7iJZHuGrGhCxr01WRdR4GgBc= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1751062507; x=1751667307; d=konsulko.se; s=rsa1; h=to:references:message-id:content-transfer-encoding:cc:date:in-reply-to:from: subject:mime-version:content-type:from; bh=T13rm+wv6m7Nf4D6++TT2JCiBV05mPjobL0Tfcq7go4=; b=oSMqxT3mVtIgTyhYM6isadJjx8RHx8NrYpsWHnGdCFEgFcp7x6cZt1jTnQnwpQEeyydlI7njLEH2r e8SEUrF1tTiChSSBlrpNXX2nGnqLgOBlnhXAJCiipkZZHmKww618I5Zo+Ga+sqxpSY9THsDwROy5Rx yr6C6OIvAv+zfa4N2exSRHayU42eVqubfyyI3NWBP22jCvwCHJ2gJdhEt6cLaBSobhTYiGrYB3Sr7S wlMkKBTz6s990Plk4bLa4ZCCHTDyPYn0ORS5MekXf9YE0IlDYIt4VCrSUJhcchQGjLDpRo/NqW2ir5 KSa9aWXTXcyF7G4w0nfwqMvI+0jdCjA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; t=1751062507; x=1751667307; d=konsulko.se; s=ed1; h=to:references:message-id:content-transfer-encoding:cc:date:in-reply-to:from: subject:mime-version:content-type:from; bh=T13rm+wv6m7Nf4D6++TT2JCiBV05mPjobL0Tfcq7go4=; b=bYyN+5qobIuCXNTBp5b7opT+/0Ytp0PMyhfzRgPMGd7PzQEpwWHGZiMcsQ4CQzTO1Lf1MLwIaoiA9 SszUceJDQ== X-HalOne-ID: 2e079c8b-53a4-11f0-b39e-f78b1f841584 Received: from smtpclient.apple (c188-150-224-8.bredband.tele2.se [188.150.224.8]) by mailrelay1.pub.mailoutpod2-cph3.one.com (Halon) with ESMTPSA id 2e079c8b-53a4-11f0-b39e-f78b1f841584; Fri, 27 Jun 2025 22:15:07 +0000 (UTC) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.200.121\)) Subject: Re: [PATCH 2/4] mm/slub: allow to set node and align in k[v]realloc From: Vitaly Wool In-Reply-To: Date: Sat, 28 Jun 2025 00:14:57 +0200 Cc: Danilo Krummrich , linux-mm@kvack.org, akpm@linux-foundation.org, linux-kernel@vger.kernel.org, Alice Ryhl , rust-for-linux@vger.kernel.org Content-Transfer-Encoding: quoted-printable Message-Id: <3E1CA84B-3670-4887-ADA1-055E8A5DE806@konsulko.se> References: <20250627092901.356909-1-vitaly.wool@konsulko.se> <20250627093714.402989-1-vitaly.wool@konsulko.se> To: Uladzislau Rezki X-Mailer: Apple Mail (2.3826.200.121) X-Rspam-User: X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 762F918000A X-Stat-Signature: gokz8imus69jtc11px7yyeae4uz4nffc X-HE-Tag: 1751062509-701859 X-HE-Meta: U2FsdGVkX1+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QVIojy17sfQRuWQfzCrfEZPaHxR/Bxyl0neyMu74JX01pFVxQSSOAfonKuwztsCTPBAKZhBZoViNsdTbK3kogzhG63B5Rd1gn7qTa0tBXx5fnquG0mo1udA== 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 Jun 27, 2025, at 7:54=E2=80=AFPM, Uladzislau Rezki = wrote: >=20 > On Fri, Jun 27, 2025 at 02:01:23PM +0200, Vitaly Wool wrote: >>=20 >>=20 >>> On Jun 27, 2025, at 1:42=E2=80=AFPM, Uladzislau Rezki = wrote: >>>=20 >>> Hello, Vitaly, Danilo. >>>=20 >>>> On Fri, Jun 27, 2025 at 11:37:14AM +0200, Vitaly Wool wrote: >>>>> Reimplement k[v]realloc_node() to be able to set node and >>>>> alignment should a user need to do so. In order to do that while >>>>> retaining the maximal backward compatibility, the following rules >>>>> are honored: >>>>> * kmalloc/kzalloc/krealloc remain unchanged >>>>> * kvmalloc/kvrealloc/kvcalloc remain unchanged >>>>> * kvrealloc remains unchanged >>>>> * kvrealloc_node is implemented as a new function taking align and >>>>> NUMA id as extra parameters compared to kvrealloc. >>>>> * krealloc_node is implemented as a new function taking NUMA id >>>>> as an extra parameter compared to krealloc >>>>> * kvmalloc_node/kvzalloc_node/kvcalloc_node get an extra parameter >>>>> (alignment) >>>>=20 >>>> I see what you're doing here: >>>>=20 >>>> You created vrealloc_node_noprof() in the previous patch, taking = the following >>>> arguments: >>>>=20 >>>> vrealloc_node_noprof(const void *p, size_t size, >>>> unsigned long align, >>>> gfp_t flags, int nid) >>>>=20 >>>> And now you're aligning the newly introduced krealloc_node() and >>>> kvrealloc_node() with that. >>>>=20 >>>> The idea for having an align argument on krealloc_node() simply is = that it >>>> fails if the alignment requirement can't be fulfilled by the = corresponding >>>> kmalloc bucket, such that we can fall back to vrealloc_node() in >>>> kvrealloc_node(). >>>>=20 >>>> Generally, this makes sense to me. >>>>=20 >>>> However, now you consequently have to add the align argument to = kvmalloc_node(), >>>> kvzalloc_node(), kvcalloc_node() as well. >>>>=20 >>>> This is what creates this huge diffstat changing all the users. >>>>=20 >>>> IMHO, the problem here was introduced already with = vrealloc_node_noprof() taking >>>> an align argument in your previous patch, since now you have to = adjust >>>> everything else to logically follow the same naming scheme. >>>>=20 >>>> Instead, I think you should introduce vrealloc_node_align(), >>>>=20 >>> I am probably missing something. Could you please clarify why do you >>> need the vrealloc_node_align() and other friends? Do you have users >>> which require vrealloc() or kvrealloc() to support nid and align = from >>> Rust API point of view?=20 >>>=20 >>>=20 >>=20 >> Alignment for Rust allocators should generally be supported, it=E2=80=99= s been listed as TODO for a while. >> Node awareness is very desirable for e.g. KVBox and for the coming = zpool mapping. >>=20 > Thank you for clarification. The comment about TODO i saw. Initially i > thought that there is a real demand in having it for some users. But > this is just for future potential ones. So, maybe the comment should > be removed instead? But i do not have a strong opinion here. Well, the zpool Rust mapping is in fact ready and will follow shortly = after we sort out the issues with this patchset. ~Vitaly >=20 > vrealloc_node_align() sounds indeed better for that purpose. >=20 > -- > Uladzislau Rezki