From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 164B732A3C8 for ; Mon, 2 Mar 2026 14:52:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772463147; cv=none; b=Qjn4X6yoa+CZhcWmHJ0RSUl+NSyzsrj9rer2VrnuY6X9cgIFp43pctkJa6xGqohYzgDR59J9IZic+N2XXdY+BDg+gYu+evf4bOJG4/XvlnM3gZ5tNJn70mcUL0eYiyJ2GGVdWdNaNiDsbyxu6Np68PEg4sM0lcn+YFEpp1GAk24= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772463147; c=relaxed/simple; bh=/jxA7Ndeavxk11+Bja4ayPX5ip1pxeuMuJSI7X8O/Ek=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=ucgECxX0K9udTvR4HRv7FwDvL4rQLf9mbq6yuHVtsj0vv3XuaWODO8VVY40zN/5gq2/3XT25NgfjSqZFNl0R8uWmJiw/3fZ3IET5lYw72epx49rCDq7MR10SBsYbv1I+KvOhIREVZBit8ih0C/T7zy6DaCKQoT4k27cJ3pDYVxo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 345B31477; Mon, 2 Mar 2026 06:52:19 -0800 (PST) Received: from [10.164.19.52] (unknown [10.164.19.52]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 10A103F694; Mon, 2 Mar 2026 06:52:22 -0800 (PST) Message-ID: <6fa7dda0-55e9-46b6-b483-a6dd82f34d35@arm.com> Date: Mon, 2 Mar 2026 20:22:19 +0530 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] mm/vmalloc: Fix incorrect size reporting on allocation failure To: "Uladzislau Rezki (Sony)" , linux-mm@kvack.org, Andrew Morton Cc: Michal Hocko , Mikulas Patocka , Vishal Moola , Baoquan He , LKML References: <20260302114740.2668450-1-urezki@gmail.com> Content-Language: en-US From: Dev Jain In-Reply-To: <20260302114740.2668450-1-urezki@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 02/03/26 5:17 pm, Uladzislau Rezki (Sony) wrote: > When __vmalloc_area_node() fails to allocate pages, the failure > message may report an incorrect allocation size, for example: > > vmalloc error: size 0, failed to allocate pages, ... > > This happens because the warning prints area->nr_pages * PAGE_SIZE. > At this point, area->nr_pages may be zero or partly populated thus > it is not valid. > > Report the originally requested allocation size instead by using > nr_small_pages * PAGE_SIZE, which reflects the actual number of > pages being requested by user. > > Signed-off-by: Uladzislau Rezki (Sony) LGTM Reviewed-by: Dev Jain > --- > mm/vmalloc.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/mm/vmalloc.c b/mm/vmalloc.c > index 61caa55a4402..a06f4b3ea367 100644 > --- a/mm/vmalloc.c > +++ b/mm/vmalloc.c > @@ -3901,7 +3901,7 @@ static void *__vmalloc_area_node(struct vm_struct *area, gfp_t gfp_mask, > if (!fatal_signal_pending(current) && page_order == 0) > warn_alloc(gfp_mask, NULL, > "vmalloc error: size %lu, failed to allocate pages", > - area->nr_pages * PAGE_SIZE); > + nr_small_pages * PAGE_SIZE); > goto fail; > } >