Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp1424248iof; Tue, 7 Jun 2022 05:29:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxPEon7X0xAy9V8HAUn+B3l8RU/ic09mbH7F11KtDYdHUqkToaB0haQEaFats4fcLJ99OaH X-Received: by 2002:a17:90b:1bd0:b0:1e8:9ac9:c3ec with SMTP id oa16-20020a17090b1bd000b001e89ac9c3ecmr5580079pjb.117.1654604945567; Tue, 07 Jun 2022 05:29:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654604945; cv=none; d=google.com; s=arc-20160816; b=dHpbTpP5qf6c3zPd6QYCmyhJecj5CSxsPDvvB0J331zhfBOJrHSjr0BwT7BYZhIBX7 dNTORBR5p/4EHXOGL36I/1aCR8MoQXEpfg/ARw1DJuKV2BQmpgHYJuqEDwEnsukZEevO HJZIMp4jBYcG7wd7TJjSZ8kBgwNk/h2bXYm3TVqnL58vc9VOIdKD5lPbz+b1vrMogFRD QHcpmOiTl0SuxApoiaeqteQLh+dnF8SJYKp3ro4eheKvmzsCVF4GuA87NyLgNDq2d5IO Rrb8S4euqBlw0OsDf8olnbUKw7MaJr4c6sKJzp3Y9mvpS2Hg5qdVu1SaZXxpywHg8I9P Qdxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:date:from:dkim-signature; bh=cfOlBmdhOyczhq1q2DRlk1Hjg1wlO53vwRDEPJxbnVw=; b=nR0Zi8KB/t+QYabjd0utikM6PnF1zdds+Z7OYiL0sht4d1fi7GH2uD1dnlPa2m0X5Z rT1TzvOnlc7PdFhe7y50fGrAhq6oP0xGYLFSdWROwWKQTDHuqebYuRDEd1pNJrRMNEJq qSoTVU+BrjDL8kN+zcvHT0TtDRvox3XTQ2iGlsqKbnkvtmnlB7S+MxLbrM/KMNmlCNRX 3MoT88LJP8SlfAFUj9GFEJKwqBGaxUJYrlA3VEfSE89RrtRNj1sYUCXF7AIzhe878xCQ B97YgTFtKIlg1g91OO4UG42b0P7pcS0sf7VCKk1LPgWL6CQsEGz1U35YJHIdH8Ku8Nit 0rog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=myTkGQ7V; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t14-20020a17090340ce00b00153b7df656asi23576552pld.490.2022.06.07.05.28.48; Tue, 07 Jun 2022 05:29:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=myTkGQ7V; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230135AbiFFU6K (ORCPT + 99 others); Mon, 6 Jun 2022 16:58:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39502 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234363AbiFFU54 (ORCPT ); Mon, 6 Jun 2022 16:57:56 -0400 Received: from mail-lf1-x134.google.com (mail-lf1-x134.google.com [IPv6:2a00:1450:4864:20::134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 347E7149A93 for ; Mon, 6 Jun 2022 13:46:40 -0700 (PDT) Received: by mail-lf1-x134.google.com with SMTP id w20so3522396lfa.11 for ; Mon, 06 Jun 2022 13:46:40 -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=cfOlBmdhOyczhq1q2DRlk1Hjg1wlO53vwRDEPJxbnVw=; b=myTkGQ7V5AWMiimvQu2/Os6R/NXjN+F722C15P5Rt9hbdAQ42xHoOWM7WSAJzJAvqB 3A2N2xVkN4gtpgM1urV/SdSztoebbHVa0fTE174RYofnYwKECoVQMz9kj44tnpiOHI0p lVZu0PwvGtH5Jrl3hkiUbSzwK+UtDHY7EgowAC9DEZ9KqhiyogHhoLwzuMzibcbm250+ n/FnYCWfiRX4FW7+7p8ig45AQHlx11Nng8yvuzi7l/zXD6pOsMMyu4FPua4kr15nTP6r QRa4WdlsQTjPZiXdSZ/cyQp2/UlKgfGNQubcDkVHQ2PwKX9Et84iKWidtPJKUeUe1pW1 Kzyw== 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=cfOlBmdhOyczhq1q2DRlk1Hjg1wlO53vwRDEPJxbnVw=; b=TvbOrQZ6xvqLbyRs4rfsSmjBeASd8YVD2rVydryNvYTgZrvaj0iL0BnY9nvo+Uhf/F d8bpJmr14TmaPF0DzkllIkh4MeHT1J1HRP/RF0NThfIZ0POAx/wwkCtnAU/Lf8AVbnP9 gmiOkA7yGIHbkutQb90MDX3ht00TVwfyu7eW7IMz+AttXla8okrOvUEn9zPNCIF8qpZW BMwTBMguA09q0s1UE6ZVE+GltzQvrFCKU4UQWYfhjNLgbe7etlXnwRUcuZ8HIMGcPKiV qkICQf3/KH3EwLt3nILp+A/x8la9bTqEtpgdL6xZD71fW4ZLdGqq3LWN/yY7XtPpy6Gq ywqQ== X-Gm-Message-State: AOAM533b1menKo0e+oom5m+5IF5wGGF9SmI9bMyOeNRc/O4gHSiRdca0 FcNI7z1ZgTninLh0fzoEQpg= X-Received: by 2002:a05:6512:752:b0:479:1b68:722c with SMTP id c18-20020a056512075200b004791b68722cmr11680076lfs.59.1654548398488; Mon, 06 Jun 2022 13:46:38 -0700 (PDT) Received: from pc638.lan ([155.137.26.201]) by smtp.gmail.com with ESMTPSA id a16-20020a2e88d0000000b0025538905298sm2587600ljk.123.2022.06.06.13.46.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jun 2022 13:46:38 -0700 (PDT) From: Uladzislau Rezki X-Google-Original-From: Uladzislau Rezki Date: Mon, 6 Jun 2022 22:46:36 +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 2/5] mm/vmalloc: remove the redundant boundary check Message-ID: References: <20220606083909.363350-1-bhe@redhat.com> <20220606083909.363350-3-bhe@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220606083909.363350-3-bhe@redhat.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 On Mon, Jun 06, 2022 at 04:39:06PM +0800, Baoquan He wrote: > 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", > -- > 2.34.1 > Make sense to me: Reviewed-by: Uladzislau Rezki (Sony) -- Uladzislau Rezki