From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id B45B3C433EF for ; Mon, 6 Jun 2022 23:35:05 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 17B426B0072; Mon, 6 Jun 2022 19:35:05 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 12BAF6B0073; Mon, 6 Jun 2022 19:35:05 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F34576B0074; Mon, 6 Jun 2022 19:35:04 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id E443D6B0072 for ; Mon, 6 Jun 2022 19:35:04 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id B9D08351B7 for ; Mon, 6 Jun 2022 23:35:04 +0000 (UTC) X-FDA: 79549418928.09.FE3A9BA Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf04.hostedemail.com (Postfix) with ESMTP id 7AABC40041 for ; Mon, 6 Jun 2022 23:34:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1654558503; 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=s4IezUTWggXGPOKGySEBoAtlNsKku7jiGHhVNtLr7us=; b=JszwSeoks9Z6EiD5fEwM5pwdWmRe8Z5W/2iefIDiwFg9bGglvoou9hKLdhooKweC6yByw4 oy2MzL8idfBvh1VurENfE1U+a8ipaM08Ddwt6a6ckVOatcOIFR4s2DvWfW37v9ufzD8kK5 82YzidVvRRqQcMKsUrh48egJgFQ4zXA= Received: from mimecast-mx02.redhat.com (mx3-rdu2.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-433-YX7i_jadODWTHeVDUt9k4g-1; Mon, 06 Jun 2022 19:34:59 -0400 X-MC-Unique: YX7i_jadODWTHeVDUt9k4g-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A9B901C1C1A1; Mon, 6 Jun 2022 23:34:58 +0000 (UTC) Received: from localhost (ovpn-12-18.pek2.redhat.com [10.72.12.18]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D3BD840CF8EA; Mon, 6 Jun 2022 23:34:57 +0000 (UTC) Date: Tue, 7 Jun 2022 07:34:54 +0800 From: Baoquan He To: Uladzislau Rezki , akpm@linux-foundation.org Cc: npiggin@gmail.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/5] mm/vmalloc: remove the unnecessary type check Message-ID: <20220606233454.GB234358@MiWiFi-R3L-srv> References: <20220606083909.363350-1-bhe@redhat.com> <20220606083909.363350-2-bhe@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Scanned-By: MIMEDefang 2.84 on 10.11.54.1 X-Rspam-User: Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=JszwSeok; dmarc=pass (policy=none) header.from=redhat.com; spf=none (imf04.hostedemail.com: domain of bhe@redhat.com has no SPF policy when checking 170.10.129.124) smtp.mailfrom=bhe@redhat.com X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 7AABC40041 X-Stat-Signature: 4r74pirbscg8zq1a8sgs9u4bdm8t7e56 X-HE-Tag: 1654558482-240138 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 06/06/22 at 10:36pm, Uladzislau Rezki wrote: > > In function adjust_va_to_fit_type(), it checks all values of passed > > in fit type, including NOTHING_FIT in the else branch. In fact, it's > > unnecessary to check NOTHING_FIT since the check has been done before > > adjust_va_to_fit_type() is called in all call sites. So clean it up. > > > > Signed-off-by: Baoquan He > > --- > > mm/vmalloc.c | 2 -- > > 1 file changed, 2 deletions(-) > > > > diff --git a/mm/vmalloc.c b/mm/vmalloc.c > > index 07db42455dd4..b7a138ab7b79 100644 > > --- a/mm/vmalloc.c > > +++ b/mm/vmalloc.c > > @@ -1418,8 +1418,6 @@ adjust_va_to_fit_type(struct vmap_area *va, > > * Shrink this VA to remaining size. > > */ > > va->va_start = nva_start_addr + size; > > - } else { > > - return -1; > > } > > > > if (type != FL_FIT_TYPE) { > > -- > > 2.34.1 > > > Why not just invoke the classify_va_fit_type() inside the adjust_va_to_fit_type()? > In this case we do not need to rely on upper-stack checks and the split logic > becomes fully implemented in one solid function. Ah, that's much better, let me post a new one. Thanks a lot.