From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796388659; b=L7I7qReGdhTZ2wzfnxI38iQwbfuig3qH//0SYkDtSqXxtnP4Ncdi7sH28lJ1nSrnbrbd GIKCunWcUsXpTa/OheMMeGE+gJ+EUz8S1APIScndr3QC9ejjOblBxvZqJXAW9zmKhg7ZH 5Robzt9STthNOF0GEAURB6TAkq2Zv8RbUyKh+ISHnO9rXikInmG/s43tYJmE5Czu+gZ3p 1Jtgj/kvQ9FGns2X1xZl95zNMcfnUipyTEgfuON9Y70X1Nov5KcJ7wZFLUmGWYnAZqJh4 z2EVHzcUpJD0oOtkEifY7kt9kyV4VQu8+MgmoGm+8h2E5TqEb/JJl0HoBHhyKsOac6w== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796388659; h=Received:DKIM-Signature:Received:Date:From:To:Cc:Subject:Message-ID: References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=ixzRLRKUYabyVsN1CmHSJq9+evpS2DIApZwhrYUhWsc=; b=okN3nbsp5HEjAzTDPydNUuP+PvP6NIMqR6Q9ENcfYDUfsk9aubXv0lpJGcUr4RYyasj8 3CKGcq7RpEgxdkv1VctNJNCy0BxECJYXbKyVhFu7/aRnO/OySHG8Ql2V45RLlIXQeQD5M CY1vO+e4i9WLgpfVJqRIs4iQ5xmUVKLvIXw/5HT9Tk6wNHGmaeJnsO1rbs8VgOB3dXCmB gBxx6EkBhtDIQIz2dbguLpfi/qE9jx77JGQsl6VcSPKu6lobHVFnIFsT92m0kIGfoYr2S qyrwNhoL6nE7x7y4ofRt07DLh4ZnI9QSHHavTK3JdkplNdsb/Hy2EMm5CWbjH1xzKpA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=cQNbIKJ0; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9F9A7606A330; Fri, 4 Dec 2026 12:50:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=cQNbIKJ0 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 266211F000CE; Fri, 4 Dec 2026 12:50:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796388659; bh=ixzRLRKUYabyVsN1CmHSJq9+evpS2DIApZwhrYUhWsc=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=cQNbIKJ06tYXDTPYhNJ0NGgW4RNMKEW4j88scnln3Od/VOxEqW5kLeHLTCv1608D1 8c2rHGN4SjZ6hEdUzDv0+GBmTQP2RD/udtU8bnZb1qYwXAo4EkDjXStWCMXUxbBkZw E8cM27mCA4IplnXTvg0Uki5XGDKUcNR1to3GTpWsxD/I8OlOYY4rX9Q9vZZMDb1qRL lVnoZmMk0/Tg8h+meyw6j+B7dRZ7wvAy4fE9XOpF6X3jrLdJlskquCkrMCno5p+LYD L+kwzAfSpoEZS9XBT+f5iBV5b0FQNCfE4mYXKCMXGd9dxX6awXErbdigFqF6k1Y0Ip ceqZLPFxaXFoQ== Received: from johan by xi.lan with local (Exim 4.100.2) (envelope-from ) id 1xZSka-00000006Hxe-3v2R; Fri, 04 Dec 2026 13:50:56 +0100 Date: Fri, 4 Dec 2026 13:50:56 +0100 From: Johan Hovold To: Andy Shevchenko Cc: Eric Yun Lin Chiang , Greg Kroah-Hartman , "Rafael J . Wysocki" , Danilo Krummrich , Bartosz Golaszewski , driver-core@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH] devres: update node debug info on in-place devm_krealloc() Message-ID: References: <20261203005704.3066960-1-ericyunlinchiang@gmail.com> <20261204003919.2280818-1-ericyunlinchiang@gmail.com> X-Mailing-List: driver-core@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Fri, Dec 04, 2026 at 01:18:06PM +0200, Andy Shevchenko wrote: > On Fri, Dec 04, 2026 at 01:09:07PM +0200, Andy Shevchenko wrote: > > On Fri, Dec 04, 2026 at 10:28:46AM +0100, Johan Hovold wrote: > > > On Fri, Dec 04, 2026 at 11:13:28AM +0200, Andy Shevchenko wrote: > > > > Doesn't matter. We should not lie to the users of the traces. If size was not > > > > shrunk, it is not changed based on what the caller of krealloc() asked for. > > > > If you want to add that to the trace, it should be an additional field or > > > > so, not the lie. OTOH you can introduce memory shrinking support to krealloc() > > > > but I have no idea what will be a perception of any of these approaches. > > > > > > I believe krealloc() can shrink, unlike devm_krealloc(). > > > > Do we have a test case for that? Because as I read the __do_krealloc() > > I see that *sometimes* (if some conditions happen)it might allocate a new > > buffer with a smaller size. kasan_krealloc() in all three cases returns > > the same address back without any reallocation done. > > > > Where am I wrong? > > So, for krealloc() required alignment is hard coded to 1, so the only way to > shrink is to use __GFP_THISNODE, but node is also hardcoded to NUMA_NO_NODE, > so no, there is no way to shrink memory with krealloc(). > > Please, correct me, if I'm wrong. You're right about reallocation, but it seems devm_krealloc() do fail to honour __GFP_ZERO when shrinking. Johan