From patchwork Wed Sep 26 06:54:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yang X-Patchwork-Id: 10615339 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4A99815A6 for ; Wed, 26 Sep 2018 06:54:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3C4DB2A730 for ; Wed, 26 Sep 2018 06:54:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 309F92A73D; Wed, 26 Sep 2018 06:54:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D311B2A730 for ; Wed, 26 Sep 2018 06:54:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726467AbeIZNFm (ORCPT ); Wed, 26 Sep 2018 09:05:42 -0400 Received: from mail-pg1-f194.google.com ([209.85.215.194]:39232 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726343AbeIZNFm (ORCPT ); Wed, 26 Sep 2018 09:05:42 -0400 Received: by mail-pg1-f194.google.com with SMTP id 85-v6so10350634pge.6 for ; Tue, 25 Sep 2018 23:54:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=tpyM7xXatwkWyaToB7IqeZSd7QPPsYJ/2o3u+1ZS098=; b=YN8pcuHDdu0xck3HTNp9p/WKRkREQzroHzR0Cp0iPbxNq4Os1F7xnkYsHzGKNO8FgG ScEUhTnfKsYL2NeSx+BeUJgfVJ/GKpRkSgLW4VgVVf6pmWrSRSR05E3rtqCL1F49mbIi d5ZXP7nIeJlNxZnICHmZ3Sw+20qbkRtUJ35D1cwwjpYHAl94rjLo0SlJ3/5NTXXJS4sr bdRROi0wE/JMAZvCKvvMLEGFbzNPTQeSVb44nq2wnlJB2oDlA1ICBUhdB5hARNC0nJv5 c0VT9Gd+V0eAp+Z3jiCmCM6hSGLw2yv+uG3RkF6KTavn3B4cKdvQTh1KkWtvrRfgEE9P H6Ig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=tpyM7xXatwkWyaToB7IqeZSd7QPPsYJ/2o3u+1ZS098=; b=L1y80gZ7BadMHzhvPVHuP63XTXlOSRCiAShii4RyC4KQfx3SNQDwpciayc/34Uv6Hc aVtIGXSrMYTptmhAxRjeucVd9niGw2F/dy3lODSGINNyPXz1MzdBhVooCdOPuLoPVsrh FN53WAk2EkYe1GGaIaVS//pA44CTFbBoQ9e7p1GXP1zEfqXu2Oku4OEWGhN8aPLtvuxR cWXmOGXIRDQzzAxwbW1cZkWZaEvZ7eb7xpMmOcEhrOyp/AAbow+XebutkNGbKx6O/9gh BkVImUDKPwLegFkKbtqcoKgN/LlGlG40xyPkxs9/TEG1GwXG62QQD1uMEkSazxuNA0rp k1Iw== X-Gm-Message-State: ABuFfoh+EAOPqaE7l2jjnOONQizc+dPXfdR5NWv9Nz6bf9iLsalzm8F9 izUBrAoGa//GUpHTnjsDTq0= X-Google-Smtp-Source: ACcGV61YG+TKFLLl3RVCb4Ur0Xa/NZ5CRnSqWBxPjtlFGxBFZaUc2UVTR+vV8u0OD8DmtphZC9NOlQ== X-Received: by 2002:a63:c702:: with SMTP id n2-v6mr4378663pgg.108.1537944856509; Tue, 25 Sep 2018 23:54:16 -0700 (PDT) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id z24-v6sm6554377pfg.183.2018.09.25.23.54.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 25 Sep 2018 23:54:15 -0700 (PDT) From: Wei Yang To: pbonzini@redhat.com, rkrcmar@redhat.com Cc: x86@kernel.org, kvm@vger.kernel.org, Wei Yang Subject: [PATCH] KVM: x86: remove check on rmap in for_each_slot_rmap_range() Date: Wed, 26 Sep 2018 14:54:07 +0800 Message-Id: <20180926065407.27518-1-richard.weiyang@gmail.com> X-Mailer: git-send-email 2.15.1 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In loop for_each_slot_rmap_range(), slot_rmap_walk_okay() will check the rmap before continue the loop body. This patch removes the duplicate check on rmap in the loop body. Signed-off-by: Wei Yang Reviewed-by: Sean Christopherson --- arch/x86/kvm/mmu.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index 9ef1438be5f5..371d200ffd4a 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c @@ -5456,8 +5456,7 @@ slot_handle_level_range(struct kvm *kvm, struct kvm_memory_slot *memslot, for_each_slot_rmap_range(memslot, start_level, end_level, start_gfn, end_gfn, &iterator) { - if (iterator.rmap) - flush |= fn(kvm, iterator.rmap); + flush |= fn(kvm, iterator.rmap); if (need_resched() || spin_needbreak(&kvm->mmu_lock)) { if (flush && lock_flush_tlb) {