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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 95419C43334 for ; Mon, 6 Jun 2022 20:40:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234203AbiFFUjt (ORCPT ); Mon, 6 Jun 2022 16:39:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44628 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234063AbiFFUjW (ORCPT ); Mon, 6 Jun 2022 16:39:22 -0400 Received: from mail-lf1-x12f.google.com (mail-lf1-x12f.google.com [IPv6:2a00:1450:4864:20::12f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DCD3D104C9A for ; Mon, 6 Jun 2022 13:36:07 -0700 (PDT) Received: by mail-lf1-x12f.google.com with SMTP id u26so24397354lfd.8 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=ULfwvXqjbqYecdear00yIbOTBHuy73aNIr7PX3LlD3Q1DjYXNPHdHycoVXAP2UJSwd qcnDGk3H4ByXqgW8zYdImSAa9fQy2No+G2QwrAYfcum4gWgQPb0UEcbWQkHDGXgMuriJ UcniAgH5BDxVUCf2989+m4bJd6P78v0M2KMyA738wmX9OJAIaeT/CbY6oDaFrnNdk4GO f/0cDG7EbA8M9Iwpbf+jRYDGAxlusvd+CfdQuc17CAd/Dcy5XqRliXwj0COryRMollxz 5ogaEhgwdmol36wtAoTANChkmNoiQ2VQHBc9g39+Iq6qhllb0AKftYmN5tlOJtivz+z5 Awzg== X-Gm-Message-State: AOAM5301cEK9bgb71l8lOcmrIH1hteEz9bX/dtmsnNZkfAn5FzvLGWvl dTgej2Eg7AbUo5x0FRqNopY= 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> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > 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