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 493FEC43334 for ; Mon, 6 Jun 2022 20:36:09 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D754C6B0072; Mon, 6 Jun 2022 16:36:08 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D238A6B0073; Mon, 6 Jun 2022 16:36:08 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BED0A6B0074; Mon, 6 Jun 2022 16:36:08 -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 ADDC36B0072 for ; Mon, 6 Jun 2022 16:36:08 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 8A27B20A88 for ; Mon, 6 Jun 2022 20:36:08 +0000 (UTC) X-FDA: 79548968016.18.FBDF087 Received: from mail-lf1-f49.google.com (mail-lf1-f49.google.com [209.85.167.49]) by imf03.hostedemail.com (Postfix) with ESMTP id 4557D20052 for ; Mon, 6 Jun 2022 20:35:51 +0000 (UTC) Received: by mail-lf1-f49.google.com with SMTP id s6so25085225lfo.13 for ; Mon, 06 Jun 2022 13:36:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:date:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=0RLGEEsboSLHGJxAqv9pnzJzu69ELTjI+jQtVVqn7U0=; b=gt8SezvDbZycK1axO6XFjf25V2bD5/SJOfvuJWnNiZvKnsE7YZLt7D8gbHwBUHp6AP KDO3PQzULFrf4XdekutMxswJNqdG6kGxDGdkGVsLwbDPH8/APGpsWx3jN8fFB9jhC+s8 9sK8hNtPV63/KqDI/oQhcxH7ZE8IOPo/e0BPAB+BBJECxDok/Kcs/djvC5ovNF8wVKt/ DuxFydk3tawgK0AkMdfB0d6VJ6s8L3ooiI0kpaAkL8khlaoCLnW8cAnrBXJhSLs6FZPb oaabwQqaEm4BugV2aSey8PhCTYaes93stZqL7vWbeHlQlsocrxrSXucBYXrFUH9oycDB 6HQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:date:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=0RLGEEsboSLHGJxAqv9pnzJzu69ELTjI+jQtVVqn7U0=; b=ltpJg2aenc0ldX7Mp7l2OOz7uuqf8jAbhiyqkl4YnHRIbkNPpCFxmG/yB4zL5Ifq2y G7rkfiwHTfC/8/ztSw0gtf15I7cHLsiaxoW9+Yb82S9PV/qxY/sXXAdmdR7k/1QvvckG wGSVuV87Z3815qKGnPYbKShwpCR+qheAQ0XCw+bmBIOQwrPRvX6BHXLDg3kmvlcSTKP/ OWKcVACzxmnN4L7EJTTFLc3yew12A8gvZMSBHUd8v+goExCNtxHYIOKEM7D+eRoDiI03 GT8vmBF8uUWdgD/CndNazEU5kRwJNHS+ORwOlM6W7f0Wuvj8HjryQNoGywZRFxWSYOhK 4lZw== X-Gm-Message-State: AOAM532xXgP+wSUDfOUCupSSJBY3otv1ZevHaik2l+SoJJZI1sydWz69 o2LRpSkFHVM3ZNhZhaRimV8= X-Google-Smtp-Source: ABdhPJwwWpuKBF7Dn3+cvtdNRSjRg9kr2U1RMytMewXQnBAV4us4nr8yDCn9hH/mBKiE/Zx4j3zQCQ== X-Received: by 2002:ac2:5f92:0:b0:479:112e:76d7 with SMTP id r18-20020ac25f92000000b00479112e76d7mr15102887lfe.189.1654547766087; Mon, 06 Jun 2022 13:36:06 -0700 (PDT) Received: from pc638.lan ([155.137.26.201]) by smtp.gmail.com with ESMTPSA id e2-20020ac24e02000000b0047900e9a9d2sm2982352lfr.266.2022.06.06.13.36.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jun 2022 13:36:05 -0700 (PDT) From: Uladzislau Rezki X-Google-Original-From: Uladzislau Rezki Date: Mon, 6 Jun 2022 22:36:03 +0200 To: Baoquan He Cc: akpm@linux-foundation.org, npiggin@gmail.com, urezki@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: 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: <20220606083909.363350-2-bhe@redhat.com> X-Rspamd-Queue-Id: 4557D20052 X-Stat-Signature: b9cmd3fzd7qtcan8bdzouppgrh5duzt9 X-Rspam-User: Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=gt8SezvD; spf=pass (imf03.hostedemail.com: domain of urezki@gmail.com designates 209.85.167.49 as permitted sender) smtp.mailfrom=urezki@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-Rspamd-Server: rspam08 X-HE-Tag: 1654547751-7356 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000214, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: > 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. -- Uladzislau Rezki