Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp311692ybl; Wed, 21 Aug 2019 19:56:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqxIEf8ehTue23ahNzPoFJDhf0Z3msb4fXtURLzQUKTukjC8boh3z/nQlOGwr7/LdYjUGnZb X-Received: by 2002:a17:902:a981:: with SMTP id bh1mr37796707plb.236.1566442612171; Wed, 21 Aug 2019 19:56:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566442612; cv=none; d=google.com; s=arc-20160816; b=ZIz711eyeyaJCLZjmG5dTIjJsPlM9u82M5lKJT7vcf9+eF3eNSRFl9hGp5i0ja2ikp ZHEHwl78eb1NaFTOHN9hVaEH84pR8AqwIylwNwnIHjBc9YGZM+WNNt/B7uSGOUEq4XKB 9emRqgsaBbcDKe1pxK0k7B2hGhBmVbAY8vmUV0ZfP5hfDjmEPyWX6m1W/MffiBw2MO4d A7+b25VVOQ1CuDyDwJxvyLDA8BobVIXkL1sAzw6qbjOld5PnELK+jdfMB1Bc5W/k5lPb W0l4JVFz1hafGryR16mlDuYti1RTRGrIF3aWVuytef/md0rzHiyvGkMBKxW3pzfpUtpv xL9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=WJD+UEjxFRTpflyillBFCzijkgTNbLGzgTRaUVB/g0I=; b=jgRVHrVmc4EYQHh03RVLGgYvxYQ6rYbxRmS6kC+j2t96Bo8YoU4BdA7loL/nS/Mny7 skZoZNvGshIEb5l1eyPAhIKQdZCJe1CmNbYYkGNbBx3n4JijeuWngQbfP9OJef4LVnP7 JojoKreGBm4qKdQVwh9tfvy092mJaxiwL1KswC4FV6lOw7fm3whGFo3RE1Vq4Sv3yWj4 beFnMqeNjGgf94CWb7d7rCy4HzWE5YlbSNS5SiX8pmHWR7WE3jAswA65mqs24u+cECcZ qVrVGexS1/5Pg9dx9fTZe1bA2FYy6hVYJ7TunhoBkobLwNSMbwtF4nTMau3PS0OdMoEH qROw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t15si15409967pgv.546.2019.08.21.19.56.36; Wed, 21 Aug 2019 19:56:52 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730730AbfHVBvQ (ORCPT + 99 others); Wed, 21 Aug 2019 21:51:16 -0400 Received: from verein.lst.de ([213.95.11.211]:42693 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730716AbfHVBvQ (ORCPT ); Wed, 21 Aug 2019 21:51:16 -0400 Received: by verein.lst.de (Postfix, from userid 2407) id 9559C68BFE; Thu, 22 Aug 2019 03:51:13 +0200 (CEST) Date: Thu, 22 Aug 2019 03:51:13 +0200 From: Christoph Hellwig To: Atish Patra Cc: linux-kernel@vger.kernel.org, Albert Ou , linux-riscv@lists.infradead.org, Palmer Dabbelt , Paul Walmsley , Christoph Hellwig , Anup Patel , Andreas Schwab Subject: Re: [PATCH v3 3/3] RISC-V: Do not invoke SBI call if cpumask is empty Message-ID: <20190822015113.GC11922@lst.de> References: <20190822004644.25829-1-atish.patra@wdc.com> <20190822004644.25829-4-atish.patra@wdc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190822004644.25829-4-atish.patra@wdc.com> User-Agent: Mutt/1.5.17 (2007-11-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 21, 2019 at 05:46:44PM -0700, Atish Patra wrote: > SBI calls are expensive. If cpumask is empty, there is no need to > trap via SBI as no remote tlb flushing is required. > > Signed-off-by: Atish Patra > --- > arch/riscv/mm/tlbflush.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/arch/riscv/mm/tlbflush.c b/arch/riscv/mm/tlbflush.c > index 9f58b3790baa..2bd3c418d769 100644 > --- a/arch/riscv/mm/tlbflush.c > +++ b/arch/riscv/mm/tlbflush.c > @@ -21,6 +21,9 @@ static void __sbi_tlb_flush_range(struct cpumask *cmask, unsigned long start, > goto issue_sfence; > } > > + if (cpumask_empty(cmask)) > + goto done; I think this can even be done before the get_cpu to optimize it a little further.