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 44F46C77B7F for ; Fri, 27 Jun 2025 17:54:44 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 847656B00B3; Fri, 27 Jun 2025 13:54:43 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 81EF96B00B6; Fri, 27 Jun 2025 13:54:43 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 75BC56B00B7; Fri, 27 Jun 2025 13:54:43 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 681756B00B3 for ; Fri, 27 Jun 2025 13:54:43 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 0FCFF1D353A for ; Fri, 27 Jun 2025 17:54:43 +0000 (UTC) X-FDA: 83601930846.05.634B5CE Received: from mail-lj1-f181.google.com (mail-lj1-f181.google.com [209.85.208.181]) by imf06.hostedemail.com (Postfix) with ESMTP id 058B0180009 for ; Fri, 27 Jun 2025 17:54:40 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=fVcsLGqC; spf=pass (imf06.hostedemail.com: domain of urezki@gmail.com designates 209.85.208.181 as permitted sender) smtp.mailfrom=urezki@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1751046881; 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=h0YOmbfxhQh3WFWI52qUJ9nfvXhpETfAu/SYly/J66Y=; b=n7fb9oF33wTscMLMEvthnAzH8NmPSUD70DYZFvobk0aSkIBSlelNO0ukgBp3bRpyi6QZZm U70quKmRaFAvAE1ewrzCFSKbLo1C+mM6K7RTzxCQWXdvuUDGBHCX9VwPLvDwk2f+LHsPOR Y9KdVqg1SkFPjtl+AYxYnxeJ/gjGgcI= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1751046881; a=rsa-sha256; cv=none; b=B6eb10w5pbzadKdcEpItVT3ZAbGe9PEZwWK1PC7APoXjvojnupGwPUWTjaV0kWVnaZ6COJ xFm4tbAZUH2RCPIm2nEaR//PJzHgzsquIjVzkC9ADOFRtjHrHbzjTqvSg0NNQQhia1DaNP dmTvDo7woc2BaKNRoECybdxnq+Ug8Dw= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=fVcsLGqC; spf=pass (imf06.hostedemail.com: domain of urezki@gmail.com designates 209.85.208.181 as permitted sender) smtp.mailfrom=urezki@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-lj1-f181.google.com with SMTP id 38308e7fff4ca-32b4876dfecso32956401fa.1 for ; Fri, 27 Jun 2025 10:54:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1751046879; x=1751651679; darn=kvack.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:date:from:from:to :cc:subject:date:message-id:reply-to; bh=h0YOmbfxhQh3WFWI52qUJ9nfvXhpETfAu/SYly/J66Y=; b=fVcsLGqCGtLv5JQ21SG87l4OQL8BHGiXvFn7dwtgySNWsR0oNUdPQz0lryxJ/WarRi KqOoXqLUnHHf3IDYJqc3ENxhv56uKd5GeJBjS75pZxZLI0YF80pWONDT2bkysE+nTae5 yQUHtL9I8SplhBrBxbyB9Ln8UlefhJ3x4TFwS+LWlkwiX3dSgFNSs0IoWNpGtuhQr4VQ RG2jQVX8MPM7xiysqoMnQ9KYEbhFNiVWMA0xZMsiff03GUP2rNJkndqygvWz4Ir5UxXl MYySfxsXwqnRB815QYnwXv4RYWZ2S9GNF1nZy6LOe/YmM5mUQ9JNgzlW3pRQ8r7uqkS/ iM0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751046879; x=1751651679; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:date:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=h0YOmbfxhQh3WFWI52qUJ9nfvXhpETfAu/SYly/J66Y=; b=Wz3k6dw/angbyUX2eAXI9dKDzFvWUF7S4TlFDFXOjKrJG2XJSeJaSE447dOf9DtCo8 HLnK0E9OYwqaXFbItMRImCjIzndd1CusYzoz11sDp1lLc+W+P0wZEtDQKs43OtKpsTZg /P2RExVuoIdbRq254Stc72bJQswfiFktiCuUFw+0qG7joZ+LbxOLyL1Gwuad7M8Scx+7 aMMt+IXwTemuQtqW0Bzl+dT9xosUS7V7+oxMVykukt68lNdmSnOjy+iz8Hk2vhHoUnbJ WFtXqO65tJO2n0puTVxfcu5fSPsD62rFqOE9hQplWqWXn30T1c3Wm/XMMnfgwGIlU1vA VlPQ== X-Forwarded-Encrypted: i=1; AJvYcCUju3zyXw/b1YSVmj6Oh9ycA9rYuqxyjwqkKPgHKdZIeUgdNBAf9C7BpX2PemwZhKe56yHoxsCDMQ==@kvack.org X-Gm-Message-State: AOJu0Yx4PKa+BpHMlkKQVn7XotXrUAQseiNkSZDTtGwyoKTdMzy+9A0R Cg5zNMtIT4z74z/DfgA0udWspRFJUhpDlPXDJ+lUVkRNLGVWf0JvNWyx X-Gm-Gg: ASbGnctj8g2+gd0TPF36sY8PPP9HlZQ+4hz4JqZc361/Cjlh7VWITn+hCI3Md0TKWau wdemjbC4Pk1TCFOq/rbscNXIf4y9eUT75coL/7fp/O5xYGEg1QwYp6fwnEN24rlmPxG9UlK7t9N GDCL3+krA0L2gmTjqxqn0/oyTcA/Uu2AO3v9PwjN8FP+/YkedKg4UmswxgJKrRldcnf6N8k/2dY 2sSYuWYN8qzT+JPPvtDxna2BdE+7ED3z3QYsQQ5I2ZaA+o5Bc5Pw9vXefLt0tntALyBqOzCN9CK pKerY0yRvHugKqjWbVMVdChvVSBinj7A1xn9yWRCAncjsRmvg9jWeycs0Nn9IFUP9AtkWBxd6yc 1ZMMelHqceBk= X-Google-Smtp-Source: AGHT+IG2QNA7AaHqhs/Jpn10zzFILx6zhTWKhedNqnHw6qS9jLTKQzs6R+hZswYcbG8dUKxLnApRmg== X-Received: by 2002:a05:6512:3b9f:b0:553:b054:f4ba with SMTP id 2adb3069b0e04-5550c2f5c32mr1562749e87.12.1751046878569; Fri, 27 Jun 2025 10:54:38 -0700 (PDT) Received: from pc636 (host-95-203-1-180.mobileonline.telia.com. [95.203.1.180]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5550b2ddc50sm518754e87.231.2025.06.27.10.54.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Jun 2025 10:54:37 -0700 (PDT) From: Uladzislau Rezki X-Google-Original-From: Uladzislau Rezki Date: Fri, 27 Jun 2025 19:54:35 +0200 To: Vitaly Wool Cc: Uladzislau Rezki , Danilo Krummrich , linux-mm@kvack.org, akpm@linux-foundation.org, linux-kernel@vger.kernel.org, Alice Ryhl , rust-for-linux@vger.kernel.org Subject: Re: [PATCH 2/4] mm/slub: allow to set node and align in k[v]realloc Message-ID: References: <20250627092901.356909-1-vitaly.wool@konsulko.se> <20250627093714.402989-1-vitaly.wool@konsulko.se> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 058B0180009 X-Stat-Signature: tbkt66h8i3di3i71pgiue73krnagoqys X-Rspam-User: X-HE-Tag: 1751046880-931559 X-HE-Meta: U2FsdGVkX1/WhkFNV7LQmRPx5bDs5A47voamO7R1N9aIdE4wzSqwmq3auxCmwfrcD0gCDA5bbjOiOWbgKiZJBexsKjj8CIPCUp76uz1+BHNwlO8pfLtD3JYLX8f+f9veGnkF0Rzr56535gTVBYVTYZmUaLFAdlIz0aOsi9Q8Ngk8FGcw+tYjyh4DTNKvQnAKFwGambHmA8fEwzUsKVECvK7ev/wQ1V0bJMBJWKkjmXhblf3p0BHR6Jcf8w3YtCCRpxSEpaDixh4hrAVlN55miqpD86l6wnA2EZr4Sbdg5MjjX+d0cXTx9C+m1KL8V3IvAwIsFLWo40fAW8YHC5Hqfb133Jrz/lT0vO8SsCjOIb764Snqomawynw9XYuUn6Aag1xehy7bTqL3DViKpcm+CgCJSCJpJO69l2fM1ACG0mzEoozqw/BZGO/oImUZDZ7iHBsBFtyc1IClfePJp463QRDl7X+kElF/9wWc7TNy0PB5DdgUhrZtit2IQSjwGtuXMC0COstQKfTf0/oWrB3ogRAc1KXNFk9CMJbobSqByXTyUAC3z+nlJu5vDK0M2EnN4iEyQwTbhR8XZcMnWkGEBx+SNGGGBPub3r4afYHMPE86m6E/6U615shBq40aTUaRDdK4greSJS7pMhxAduHYUVaVapgrHED7NRcQhLuLwQNvup6mvk8My+kS7GOPbQmlSU3PZ9NNFALd8/GT/qoc3+HKPA2bRuuL+ctyA+kxl1c24fIBDt2vBNhyfd+LOqRWLSPItarHqH3gM+YprG4A4ezyLMTG39qqKwHPZSe5/AXVYz3R5UOay83w+8WjAnwhHrA+Ss5Yde+MCdhNmwHo4woY0UzhpbrpLnznS+J23P8+KpW6ww+ZPNVkIz33PyaRa+efIc8iowfn+T01hsoikiSkiOtOl5kN7CuBIBr2vvcOYwJgqSOr00Q0vpXqF3rwbiccVT1yYfGuhDRla7E IoeG79/K o6F1T+NEqBfv4xmBHf2RVeZUl8r2aoRbmL0GIekJ8dm5m0Vjoo52K9diszBpew4hIw24VV5Z0gAIPkenhsuTDEf16iugAHXAVhqZPkXJvhze/du/c6nqH/tJhpbO4TFngFohIHOaVrOGVVzFbnmNDDen83MWmgWbPIAPceQe+x6yr1rsSXO2gsyczkwzgfK73W5ARWyiWiFrr87raf7L9u5i4Oga4AAYsILdqp8xB/6XxY2pi5c0FWEK6S+DKm6AOR6Gb3hQYj4QBKYTZLh4Tdxilcz12B8pV0lHgSC9CSHnurIQWd+tWOawXYsmFW1kGnLXMDCuNyc5T/TzOJQe8UjvS6COvXSJHW1WMBoJII2c0eI4OGYlfQG372EMaIvhcQWdsL4/dAceVa/zLfZnVeOHwPZHIShNEq55qCsIadTYcrx+ch6EU/z7N5S/YoYkgeYynRAMWcoxWaCmfmaNpsx1oetzalXuqHonYU4mJlyz6W7bspxqDPltCu0pawpv4of0pIHmRDsAVzTM= 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 Fri, Jun 27, 2025 at 02:01:23PM +0200, Vitaly Wool wrote: > > > > On Jun 27, 2025, at 1:42 PM, Uladzislau Rezki wrote: > > > > Hello, Vitaly, Danilo. > > > >> 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) > >> > >> I see what you're doing here: > >> > >> You created vrealloc_node_noprof() in the previous patch, taking the following > >> arguments: > >> > >> vrealloc_node_noprof(const void *p, size_t size, > >> unsigned long align, > >> gfp_t flags, int nid) > >> > >> And now you're aligning the newly introduced krealloc_node() and > >> kvrealloc_node() with that. > >> > >> 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(). > >> > >> Generally, this makes sense to me. > >> > >> However, now you consequently have to add the align argument to kvmalloc_node(), > >> kvzalloc_node(), kvcalloc_node() as well. > >> > >> This is what creates this huge diffstat changing all the users. > >> > >> 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. > >> > >> Instead, I think you should introduce vrealloc_node_align(), > >> > > 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? > > > > > > Alignment for Rust allocators should generally be supported, it’s been listed as TODO for a while. > Node awareness is very desirable for e.g. KVBox and for the coming zpool mapping. > 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. vrealloc_node_align() sounds indeed better for that purpose. -- Uladzislau Rezki