From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 071AC36E496 for ; Mon, 2 Mar 2026 17:41:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772473300; cv=none; b=oy/iQ1U93Hx05vaQqIsIDDyyAioEtGo+tJ2TWo156W+z/q4ksKikbBWXLBqAm2Ni6gZR2rqGpFgVAeVJR7nTqESSGRunAUsHKhs/6n3YSSn1vPYgaARy/xqjb77T1X52HVdXyDtFZqTaCT/ou93K/a0mCKbtfa/qjTKcBLhaAzU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772473300; c=relaxed/simple; bh=i8QFWYTFhHu2g9da22xCkvNNPVDyY6miQsY0sleU0H0=; h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References: MIME-Version:Content-Type; b=tZUEUiYo9oyf4TiZaBbBXE5UHqet/irWnswFJvKX/HEJfL106f2BNXqyGN7eCl5pb47txkzVsv7/hwv0tSoZk29n2DhEqsb9nd/s1QN3k4LoP2AsiFnGXPQMOR1yMjObUPWqMlZF9O8xIcBuvV4A/HQpS2wkgPsLwXJKimETwLs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=aO28EbfX; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="aO28EbfX" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1772473298; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=IfLRwYk4oBRwu9+5TUeOLiLw3MOcjHWn/WHPZdFC1ec=; b=aO28EbfXRmkxcgyNL3ZhNSdwxqPaZFgpSiht93bEy482ZNeL39uEIOv386YV4MIKTiq4H2 l6XqBThINtbWB+2lCWQ7hi6idxOIx6t8K1U+2iqfQgT9YAoqTxKeNiuz7eYdgQbU5HIMLq 0IIdgfEy0u4I5tEfFxfkUd5bZDGX8Ys= Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-191-9v5o2HTGNQeJAb_86j7xLg-1; Mon, 02 Mar 2026 12:41:35 -0500 X-MC-Unique: 9v5o2HTGNQeJAb_86j7xLg-1 X-Mimecast-MFC-AGG-ID: 9v5o2HTGNQeJAb_86j7xLg_1772473294 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id C60301956067; Mon, 2 Mar 2026 17:41:33 +0000 (UTC) Received: from [10.45.224.173] (unknown [10.45.224.173]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id CDD0219560A3; Mon, 2 Mar 2026 17:41:30 +0000 (UTC) Date: Mon, 2 Mar 2026 18:41:28 +0100 (CET) From: Mikulas Patocka To: "Uladzislau Rezki (Sony)" cc: linux-mm@kvack.org, Andrew Morton , Michal Hocko , Vishal Moola , Baoquan He , LKML Subject: Re: [PATCH] mm/vmalloc: Fix incorrect size reporting on allocation failure In-Reply-To: <20260302114740.2668450-1-urezki@gmail.com> Message-ID: References: <20260302114740.2668450-1-urezki@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 On Mon, 2 Mar 2026, 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) > --- > 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; > } > > -- > 2.47.3 Reviewed-by: Mikulas Patocka Mikulas