From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=192.198.163.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796383161; b=04wzxAyyaMKS3RmuxW94ZgEiOZjKAnn8tuWsHbtroYaJmAdU5M6wFQUMPS5fGHOC8uav HAz48NpK+XHO4bTakoffhosuN/M2TabuEfoY9AW3I1prqD5mxklD+fcE4QXsllBs8+zL6 9GOV+9mPX8BVvP8ybT5Dr0OGxoyuLf3m8+qxo8o4A4cze+xElEUqBUg/zfa7pu1bBBnqq lgfHb68qKOVeUTN50mW4QbzdNYxSSIp23BsO0KvstBhtIiEK3/mdSRBlZ6yhYV36UhJ40 bOJ4kbWTCU3wlReoF1Z2IVrvgMZPR4HJqh2QmOJ/XEtI1RNru2q0CJQxy/zYAVfa8iA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796383161; h=DMARC-Filter:DKIM-Signature:X-CSE-ConnectionGUID:X-CSE-MsgGUID: X-IronPort-AV:X-IronPort-AV:Received:X-CSE-ConnectionGUID: X-CSE-MsgGUID:X-ExtLoop1:X-IronPort-AV:Received:Date:From:To:Cc: Subject:Message-ID:References:MIME-Version:Content-Type: Content-Disposition:In-Reply-To:Organization; bh=LWPJl1ChGRJGn1KDsgXTFH47HUfejhh4Ufwu0eZeHyo=; b=Lcw6NiO3ouhEnWfVkQO4Ar8Ya5UoTbKud+Vyvj5BWb37iEgS7j8v2H8NNmKybWMWbisA hKwjy58hWqDwljAGs2yMDpoMszmF/WtCOxj+WOSprDoA2PuraKngrB3x0TVYRdpORaSnt 0+EPySIhKdGte8jA/vaqSdcvq+W3yMr5rWmIZlgDPOXcCW7swmbC3f1JxO8qCH3tD54DW XMm/4qsqskRXJMDfxFeqhT68qFJ1PBioYk0Ax2sD24BdYhyhaWkexkXazY4+EfsDFgF7u +mMtw05RkdEnb++FVvvZgGuLn//lqZ3uesA5kp8DRV/ZUul11BAUys6pl2pG+W57/5g== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=linux.intel.com; spf=pass smtp.mailfrom=linux.intel.com; dkim=pass header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=LziHYcpQ; arc=none smtp.remote-ip=192.198.163.18 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.18]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B5D4A606A334 for ; Fri, 4 Dec 2026 11:19:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org B5D4A606A334 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=LziHYcpQ DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1796383161; x=1827919161; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=LWPJl1ChGRJGn1KDsgXTFH47HUfejhh4Ufwu0eZeHyo=; b=LziHYcpQAW9I74IYv5M3QmGU7cSwIgRask8KYqEIfIpyO2aQ5SyE7d89 ILUOe3NE8VkFTeNYrrjTbIWXQJVKUA6lKRo8lTgt5eJOcZ+O/bgXpzN2B JOIOMp76e/3jK7Jv1mFCUXB478BJSSYfdywrNYw/CgJVMEctOBde0n/w3 Sp+G2Z9Lg1Q/LQJ8uJvgG9RZLYVKBv7QIe1cLUPjyUBzIWF0VxYloKer4 69h2oo1ov6ZyeOpclp6HhQ7r9El0/gNSr3dtoeZMAasWy3DcMx3P98wSp WAR5wM19iQ82kM7Rj8l8eXhpyzrzAFrjM+//S8lxDpfmilJv29ykzvLie g==; X-CSE-ConnectionGUID: PzEv1Kr4Rmi3Y3zIVHJkGQ== X-CSE-MsgGUID: D44DmLHmT3OinOiZNolG+w== X-IronPort-AV: E=McAfee;i="6800,10657,11985"; a="5373353" X-IronPort-AV: E=Sophos;i="6.29,78,1794902400"; d="scan'208";a="5373353" Received: from orviesa008.jf.intel.com ([10.64.159.148]) by fmvoesa112.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Dec 2026 03:18:11 -0800 X-CSE-ConnectionGUID: hrpmhfyOQpKE9Mi5XvCBqw== X-CSE-MsgGUID: x4efeKHYTCSyVdoCg12qUg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.29,78,1794902400"; d="scan'208";a="13861008" Received: from alekseim-mobl.ger.corp.intel.com (HELO localhost) ([10.245.245.10]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Dec 2026 03:18:08 -0800 Date: Fri, 4 Dec 2026 13:18:06 +0200 From: Andy Shevchenko To: Johan Hovold 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: linux-kernel@vger.kernel.org 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: Organization: Intel Finland Oy - BIC 0357606-4 - c/o Alberga Business Park, 6 krs, Bertel Jungin Aukio 5, 02600 Espoo 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: > > > On Fri, Dec 04, 2026 at 08:39:19AM +0800, Eric Yun Lin Chiang wrote: > > > > On Thu, Dec 03, 2026 at 01:42:35PM +0200, Andy Shevchenko wrote: > > > > > Do we really support shrinking for realloc() in kernel? > > > > > I am under the impression that we don't, so in such a case info should > > > > > not be updated. Please, check this and confirm. > > > > > > > > devm_krealloc() accepts a smaller size and returns the same pointer, > > > > like krealloc() does, but no memory is given back. My changelog said > > > > "shrunk", which made it sound otherwise. > > > > > > > > The patch only changes the size recorded in the node's debug info, so > > > > on its own it only changes debug output, which is not much of a reason. > > > > I wrote it as groundwork for letting KASAN check devres allocations > > > > against the requested size rather than the rounded-up bucket, and I > > > > should not have sent it without that context. Please consider this one > > > > withdrawn. I will come back with the KASAN part as one RFC series, > > > > together with a concrete case it catches. > > > > > > 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. -- With Best Regards, Andy Shevchenko