From patchwork Mon Jun 6 08:39:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baoquan He X-Patchwork-Id: 12870120 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 DA3C4C433EF for ; Mon, 6 Jun 2022 08:39:38 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 57C838D0005; Mon, 6 Jun 2022 04:39:38 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 551648D0002; Mon, 6 Jun 2022 04:39:38 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3EF228D0005; Mon, 6 Jun 2022 04:39:38 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 309F38D0002 for ; Mon, 6 Jun 2022 04:39:38 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 0BAB634EF0 for ; Mon, 6 Jun 2022 08:39:38 +0000 (UTC) X-FDA: 79547162436.05.86BE82B Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf26.hostedemail.com (Postfix) with ESMTP id BF6FD14005C for ; Mon, 6 Jun 2022 08:39:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1654504776; 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=4YLB16QUvcdUUFPk6QE1awctWO/iWbriUwndDpk7vqk=; b=LgWnHvhy8F1Sir7UdStskxZZtNaCn9ra2ICTv4U+PSfvkFR+vDXEO9SsmBg6w0bYDaDW90 ZFrIDlQA54FD9VhvL6FHYDOlJzRLS1OG4OAW/f+Q2J5ykoMM6qMHr8+CB2BTqSEh/2mcTT 9lqHui3xGhGOR42RYf5xyaja6N2+ff4= 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-139-ktKsRVX4OzCUsjaHWM5NDQ-1; Mon, 06 Jun 2022 04:39:33 -0400 X-MC-Unique: ktKsRVX4OzCUsjaHWM5NDQ-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 73A8C811E75; Mon, 6 Jun 2022 08:39:33 +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 11EE31121314; Mon, 6 Jun 2022 08:39:29 +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 2/5] mm/vmalloc: remove the redundant boundary check Date: Mon, 6 Jun 2022 16:39:06 +0800 Message-Id: <20220606083909.363350-3-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 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: BF6FD14005C X-Stat-Signature: 3my1o9x4dbwij4a33wmy17r51bucgmr7 Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=LgWnHvhy; dmarc=pass (policy=none) header.from=redhat.com; spf=none (imf26.hostedemail.com: domain of bhe@redhat.com has no SPF policy when checking 170.10.129.124) smtp.mailfrom=bhe@redhat.com X-HE-Tag: 1654504772-280241 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: In function find_va_links(), when traversing the vmap_area tree, the comparing to check if the passed in 'va' is above or below 'tmp_va' is redundant, assuming both 'va' and 'tmp_va' has ->va_start <= ->va_end. Here, to simplify the checking as code change. Signed-off-by: Baoquan He --- mm/vmalloc.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/mm/vmalloc.c b/mm/vmalloc.c index b7a138ab7b79..c7e1634ff2b9 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c @@ -874,11 +874,9 @@ find_va_links(struct vmap_area *va, * Trigger the BUG() if there are sides(left/right) * or full overlaps. */ - if (va->va_start < tmp_va->va_end && - va->va_end <= tmp_va->va_start) + if (va->va_end <= tmp_va->va_start) link = &(*link)->rb_left; - else if (va->va_end > tmp_va->va_start && - va->va_start >= tmp_va->va_end) + else if (va->va_start >= tmp_va->va_end) link = &(*link)->rb_right; else { WARN(1, "vmalloc bug: 0x%lx-0x%lx overlaps with 0x%lx-0x%lx\n",