Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp229921iof; Mon, 6 Jun 2022 02:10:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwAu2niViauNhqTNG6BWyNkwHEqpOkjkoBES3PzTbIS0SLK1d9a1hKNjBHwAlOlZHO4pOR1 X-Received: by 2002:a17:902:7884:b0:167:4d5b:7a2f with SMTP id q4-20020a170902788400b001674d5b7a2fmr15745734pll.18.1654506614434; Mon, 06 Jun 2022 02:10:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654506614; cv=none; d=google.com; s=arc-20160816; b=I27rk4DBB+eSegqYixBQod2jLhRTypNOhlNIEki0qNjrStFL9HhJo/I+jJ6+2ZUgBD zbv64yq4liySjs8ZbXuxcCUU+mnI8m6yUveLEg9GRMjqM0Hx/vFpIhYNlCf04xtTsvHG dEH8xohet4YY0T3d/y7g/4+R6gDS4WiuWv82euarpHHKRA4G1CQt5agz7tZTqRA2iDjJ Tv8HFE0nHyTkAN+ZNrTbKFEVHwYyIoJejNqL41LGZCuInt9kAGBfu4L0qFH3FFsLoNgW K5B3VOIVYBOS5vwsqwWdVuZjs8ncYg5lcVpbDvn5wv+A+r07NFiEuCfmDgoQfOPeLlQ+ 606A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=+MgDILZKDJLFM9v8vOajOt74G/rtOqju5l9xz3EQGok=; b=ARsv7DdQsqfBIUV7tGovlaa6hOpxUW7i5Z53ChvHkIOoLY8DhTwtYhKRN/aW/e1DVj Qy9jmZ0GILznBp/nGWhW3Kiv30jhzc581QoLGJHZypAX9+Kq2ALFa5QnVxM7xzUQ0Jwf AJJRH0QYJUz71oQU1q5eprOePAYJyrV288591ln/x03AC5b2BTvf8IupJDL7kaksMi9z NvL82fXmjIZyisnnE36jxMUYamrgj0JrPe2xI3QxMMvvtkkppJ3/Wy2Rl3DEFHCmhWDi i87kCn9IlWWNT4Sya624MePQtYdbwRLgFcdEHjG8OPvs4zx08MN5g8naEb794ebqTwvJ gopw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Ou5K0nqe; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id v186-20020a6389c3000000b003fa936eedd8si20305902pgd.481.2022.06.06.02.10.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jun 2022 02:10:14 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Ou5K0nqe; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 7B94D153533; Mon, 6 Jun 2022 01:43:49 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232573AbiFFImA (ORCPT + 99 others); Mon, 6 Jun 2022 04:42:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48048 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232427AbiFFIjv (ORCPT ); Mon, 6 Jun 2022 04:39:51 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 2C079340DF for ; Mon, 6 Jun 2022 01:39:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1654504780; 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=+MgDILZKDJLFM9v8vOajOt74G/rtOqju5l9xz3EQGok=; b=Ou5K0nqednGoAdfyfjzWX7YuGRc7ggCuwa2/g77oQiI80o6DH55+RzK/eEqIpBzz+0bfJY xcmKwdoOgQTdiz/NqfNXtIXd9bgET4loSj7mj2cbdncweBjf2OjRe7uib7ExQcpSk90VWo dZqxBgyOkMqOaQttsbZ7dbCN5Du3Aw8= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-3-c-oMQXzkOoSCQb1I3mozTw-1; Mon, 06 Jun 2022 04:39:29 -0400 X-MC-Unique: c-oMQXzkOoSCQb1I3mozTw-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4315085A5BC; Mon, 6 Jun 2022 08:39:29 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (ovpn-14-4.pek2.redhat.com [10.72.14.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2B68A1121314; Mon, 6 Jun 2022 08:39:25 +0000 (UTC) From: Baoquan He To: akpm@linux-foundation.org Cc: npiggin@gmail.com, urezki@gmail.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Baoquan He Subject: [PATCH 1/5] mm/vmalloc: remove the unnecessary type check Date: Mon, 6 Jun 2022 16:39:05 +0800 Message-Id: <20220606083909.363350-2-bhe@redhat.com> In-Reply-To: <20220606083909.363350-1-bhe@redhat.com> References: <20220606083909.363350-1-bhe@redhat.com> MIME-Version: 1.0 Content-type: text/plain Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 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 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