Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp2697266rdb; Fri, 22 Sep 2023 06:14:42 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHbmSLTJ9yVxWwiX+OhlnRQMrvmqZrrhIUSXiX+8RgHfCBAkvuzR0kpBRSFCaaicFJP+0Zo X-Received: by 2002:a92:c52d:0:b0:34f:7ba2:50e8 with SMTP id m13-20020a92c52d000000b0034f7ba250e8mr8015305ili.2.1695388482158; Fri, 22 Sep 2023 06:14:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695388482; cv=none; d=google.com; s=arc-20160816; b=yor/SMCyPV6zd8Yk6aauTYHnba7ygII8jPxtfiDLYMLMeYVXMAE2TOGrXIvpe1dze2 TKU78EGLYPXhHHOWSXwhxXnQlb/rKgmn1GDX2dQhjTRgUPcifnCpP8hQm2GgLI5giIgW /sxb+0f26uLw4AOnhajSh7aOnP0gXhmZZz6/FWpKL+fC0BSpuY6p/tQdhqukZa6fRHDF 0p5XSvj3kITwlvgigwSmDTguYb+HtAvYWt7Zpwg7LLnF1n4NUqNJNVFPTtyT+FRlE4+6 iw3RMMtrHNdIibPx+u+0sNfT7sIGmRL+wFzx558/iTmUbPrlQbKlsIEy3GTM1vmu4fa6 C9oQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=4R2VSWRD7MwQzZdu/lEnfh4YG4jsT6A99YZfwGb8Ggg=; fh=0Y5JqhvdUgZ+zodE+XN/pz2tuatkYSp4lbHBThDbD48=; b=qP4AVWRpvhHsq91IDQJ9raOqqp46ZLkTHCPCZg25TXbogo2/JNv6LYbLjRDGq6/7Lh LjVdLFUYTt134xdFFC90UgFDAnl0N46sGP2NFXdmNrXnAWlVbYJzCkOat9cFJfq7JwPh umtktxY62KhUuNCkNb7HVfpxicgs/EQq4uOP2rR15Rv1O2NX/lI8ULVKMkd9o1rTemMF qmDu4qnc59l7jAgpgxH35hwuh109scZLIwbHLYGAXlJ7f4oMKrypDWGaNWe4KrY145oI igiihEUS2FoSpmP+XKmWIaxoEiNZDHL6//Aoz2OI8JK03awplshBjAncvybWhZhxBxE0 uJAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=VyaQCRaY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id u17-20020a656711000000b00565336a3cf5si3805547pgf.491.2023.09.22.06.14.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Sep 2023 06:14:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=VyaQCRaY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id CEECF84EBE2E; Fri, 22 Sep 2023 02:35:56 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232492AbjIVJfz (ORCPT + 99 others); Fri, 22 Sep 2023 05:35:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55204 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233153AbjIVJfu (ORCPT ); Fri, 22 Sep 2023 05:35:50 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8DBD4194 for ; Fri, 22 Sep 2023 02:34:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1695375294; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4R2VSWRD7MwQzZdu/lEnfh4YG4jsT6A99YZfwGb8Ggg=; b=VyaQCRaY/LdOTYUaT3/sQMTlri54zeC6MEJQ4xoB3TEOGZEWrR28yhxcqjqCAp6MF2tKpA IHIt7CAvPRX+IAg3c29Lnzs59AdzG4cUJSw+qlzT7KMLuwoqT+7vFLbtCIUTQF9wGpdeRN sF0Jb/vZHIyjK76iGvcrKDmaCjQb0fg= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-196--vhzaNQfPxaAr7mZzRqKqA-1; Fri, 22 Sep 2023 05:34:51 -0400 X-MC-Unique: -vhzaNQfPxaAr7mZzRqKqA-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B5A811C06EC4; Fri, 22 Sep 2023 09:34:50 +0000 (UTC) Received: from localhost (unknown [10.72.112.35]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 112E510F1BE7; Fri, 22 Sep 2023 09:34:49 +0000 (UTC) Date: Fri, 22 Sep 2023 17:34:46 +0800 From: "bhe@redhat.com" To: Jaeseon Sim Cc: "urezki@gmail.com" , "akpm@linux-foundation.org" , "hch@infradead.org" , "lstoakes@gmail.com" , "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" , Jaewon Kim Subject: Re: [PATCH] mm/vmalloc: Remove WARN_ON_ONCE related to adjust_va_to_fit_type Message-ID: References: <20230922062704epcms1p1722f24d4489a0435b339ce21db754ded@epcms1p1> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20230922062704epcms1p1722f24d4489a0435b339ce21db754ded@epcms1p1> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 X-Spam-Status: No, score=1.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Level: * X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Fri, 22 Sep 2023 02:35:57 -0700 (PDT) Hi Jaeseon, On 09/22/23 at 03:27pm, Jaeseon Sim wrote: > There's panic issue as follows when do alloc_vmap_area: > > Kernel panic - not syncing: kernel: panic_on_warn set ... > > page allocation failure: order:0, mode:0x800(GFP_NOWAIT) > Call Trace: > warn_alloc+0xf4/0x190 > __alloc_pages_slowpath+0xe0c/0xffc > __alloc_pages+0x250/0x2d0 > new_slab+0x17c/0x4e0 > ___slab_alloc+0x4e4/0x8a8 > __slab_alloc+0x34/0x6c > kmem_cache_alloc+0x20c/0x2f0 > adjust_va_to_fit_type > __alloc_vmap_area > alloc_vmap_area+0x298/0x7fc > __get_vm_area_node+0x10c/0x1b4 > __vmalloc_node_range+0x19c/0x7c0 > > Commit 1b23ff80b399 ("mm/vmalloc: invoke classify_va_fit_type() in > adjust_va_to_fit_type()") moved classify_va_fit_type() into > adjust_va_to_fit_type() and used WARN_ON_ONCE() to handle return > value of adjust_va_to_fit_type(), just as classify_va_fit_type() > was handled. I don't get what you are fixing. In commit 1b23ff80b399, we have "if (WARN_ON_ONCE(type == NOTHING_FIT))", it's the same as the current code. You set panic_on_warn, it will panic in old code before commit 1b23ff80b399. Isn't it an expected behaviour? > > There is another path in adjust_va_to_fit_type() which could > return failure and will be handled in alloc_vmap_area(). > Remove WARN_ON_ONCE() for this case. > > Fixes: 45c62fc2897d ("mm/vmalloc: Remove WARN_ON_ONCE related to adjust_va_to_fit_type") The commit id for Fixes tag is wrong. > Signed-off-by: Jaeseon Sim > --- > ?mm/vmalloc.c | 4 ++-- > ?1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/mm/vmalloc.c b/mm/vmalloc.c > index ef8599d394fd..4a82b6525d48 100644 > --- a/mm/vmalloc.c > +++ b/mm/vmalloc.c > @@ -1522,7 +1522,7 @@ __alloc_vmap_area(struct rb_root *root, struct list_head *head, > ? > ? ? ? ? ?/* Update the free vmap_area. */ > ? ? ? ? ?ret = adjust_va_to_fit_type(root, head, va, nva_start_addr, size); > -? ? ? ? if (WARN_ON_ONCE(ret)) > +? ? ? ? if (ret) > ? ? ? ? ? ? ? ? ?return vend; > ? > ?#if DEBUG_AUGMENT_LOWEST_MATCH_CHECK > @@ -4143,7 +4143,7 @@ struct vm_struct **pcpu_get_vm_areas(const unsigned long *offsets, > ? ? ? ? ? ? ? ? ?ret = adjust_va_to_fit_type(&free_vmap_area_root, > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?&free_vmap_area_list, > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?va, start, size); > -? ? ? ? ? ? ? ? if (WARN_ON_ONCE(unlikely(ret))) > +? ? ? ? ? ? ? ? if (unlikely(ret)) > ? ? ? ? ? ? ? ? ? ? ? ? ?/* It is a BUG(), but trigger recovery instead. */ > ? ? ? ? ? ? ? ? ? ? ? ? ?goto recovery; > ? > --? > 2.17.1 >