Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp2518175pxb; Fri, 25 Mar 2022 20:21:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzFG3HXQfv/jBIZHhd00/QK64M+mpP0DA9459m8QGgx7zrYrv8Hct4Al0Z7OaqwwKqrXSAI X-Received: by 2002:a17:906:6a08:b0:6df:d511:3760 with SMTP id qw8-20020a1709066a0800b006dfd5113760mr15171564ejc.682.1648264887259; Fri, 25 Mar 2022 20:21:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648264887; cv=none; d=google.com; s=arc-20160816; b=FKvMBSXf/dsl5+uWECMrNOXPHHuC2vkui82Zt0c68a3ufymx27D4j2v16CU3ruJ5n0 F3SxPJ73ONC0DhC8X4PO22SSJA+orJMwsTq5GBrRaVtlspXXro6J0/+fJ4d2gLqkJehI 5yd+FLISU0TDPeTOhIK6qnKEfWE3BwUyeO3VAwDN+SJssE5+4fyWvI0kIt2fEJeRlaQQ njo6du+uHtWxu5FxahA3/G5AlIflXzze0/gUhzQToHq+vFQj9QcGEUovFnw1JCPDbpwZ Hetjf5Lxd9Kte/0VQRK4SZ6O4PrkbbAWhukxRAI2he7IFPg8xO9PfyN8HdWpQMlFcYSO FPUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=w7nzRz+ku1xVPbthIr1h39WQkWceMAxSsziZ479N8l8=; b=yT8LRcakTVmDMBw6Xf506pP6XQkJX1BBR7fC0S75zYQK3Mk631ON5Dm594U+z+wTqU osl/LF1t7MZnBVFs0YRRxkNiEvQPIbzZ+ZQzqqDrHRYoYt2Qjr4s/RPQRqaEhHoTNTk/ huW3pvcbqLwCnGOMX2FHKBPbRmOEE0ADQUQ+l8uTzQhFJYHF3Z+z8LHcg3yRT/D4p/yf 7YuEuH4Zugt/pKBvyDBBzxP/20uiJa2SLFU8/arTNe1fXUYpr5hX7ERKfoKr9Mx36SkN L2K5f3DBPRjsK7rgz3YuzAbuyYJ4be++BD+AkHCtOZCfUpTyCjY1rEtY3J9Zlf2wRjNY HcLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=T9smYeqd; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qc12-20020a170906d8ac00b006df7b230bfcsi4531535ejb.182.2022.03.25.20.20.40; Fri, 25 Mar 2022 20:21:27 -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=@google.com header.s=20210112 header.b=T9smYeqd; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229592AbiCZAdf (ORCPT + 99 others); Fri, 25 Mar 2022 20:33:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45428 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229448AbiCZAdd (ORCPT ); Fri, 25 Mar 2022 20:33:33 -0400 Received: from mail-lj1-x22a.google.com (mail-lj1-x22a.google.com [IPv6:2a00:1450:4864:20::22a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A0B0D21C05D for ; Fri, 25 Mar 2022 17:31:57 -0700 (PDT) Received: by mail-lj1-x22a.google.com with SMTP id g24so12270103lja.7 for ; Fri, 25 Mar 2022 17:31:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=w7nzRz+ku1xVPbthIr1h39WQkWceMAxSsziZ479N8l8=; b=T9smYeqdyIJTv6bWc//YVfgGAAsxoJ1B2JntMbZoPtAgrdrB3YMq0Okkl/hpg7UGmf 7GoNIAta8CxY6NI6vnKrTPhKXJaYYW3Xr93Irer2PFiQTfwxOwLggMk9dsT+jYHaDVDA R3wNPAnOAk/NIvNd9yDEtLQezX8xzKR7Q9qHDmDio9lLTYhhBFQhgHn6F19BEWgA6TJV wNzWudL98d9oXkJpcEIWpxjWwLkrMch8ZDbLx074TGiQB0o+M26pC9/fhAyHTQ8EYJTa t1kdAsEyS3A/LgDNfYXbXjuHgx7GH4ZDk9hAXGMSWbL/vkC8L4BmNoAAJLRXdQ7uVTpV rJ8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=w7nzRz+ku1xVPbthIr1h39WQkWceMAxSsziZ479N8l8=; b=6+9JLEQdRnclYCf2NPROKYSvDS1T35AIg5mvEqtEmqViA3fthYkjp2OfSYfCAJPWoM DidMNoqIwKrNi5DAeuJYvaPEoK5fFV9vX1XEA5nSetWvff/lLRpjcjFmC8JxB86Ur2gb OQ3xLbuUBLQd0DozEBr3E5wDrpK3tnUrNJD3fVd6V+LV4ngfLHPFjQQ8meeOyWAbhfhK dM235kl9btMJtO/Pq1c86zX6Z+eVk21ZYUp7Nk2iclLcSBMszP/VpjqmUz/Dz7y6XAdJ fe8LMz188GN1DtfvDV6LenfyIz6DVK20Z9xWNe6z2R87khdWZHaGiwl250YrSkg33+y2 Y1AA== X-Gm-Message-State: AOAM53175NPZ9/VSoU4pV9IYRaOgFXho4z+MR6sFJWnKkk2xpwW7W0Br Nq41oGsRAsIAWdYt5r9+KeyuTYU5k4790Q16eNlNAA== X-Received: by 2002:a2e:a881:0:b0:249:6f85:d4a4 with SMTP id m1-20020a2ea881000000b002496f85d4a4mr10145003ljq.231.1648254715708; Fri, 25 Mar 2022 17:31:55 -0700 (PDT) MIME-Version: 1.0 References: <20220325233125.413634-1-vipinsh@google.com> In-Reply-To: From: Vipin Sharma Date: Fri, 25 Mar 2022 17:31:19 -0700 Message-ID: Subject: Re: [PATCH] KVM: x86/mmu: Speed up slot_rmap_walk_next for sparsely populated rmaps To: David Matlack Cc: Paolo Bonzini , Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , kvm list , LKML Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL 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 On Fri, Mar 25, 2022 at 4:53 PM David Matlack wrote: > > On Fri, Mar 25, 2022 at 4:31 PM Vipin Sharma wrote: > > > > Avoid calling handlers on empty rmap entries and skip to the next non > > empty rmap entry. > > > > Empty rmap entries are noop in handlers. > > > > Signed-off-by: Vipin Sharma > > Suggested-by: Sean Christopherson > > Change-Id: I8abf0f4d82a2aae4c5d58b80bcc17ffc30785ffc > > nit: Omit Change-Id tags from upstream commits. Thanks for catching it. > > > --- > > arch/x86/kvm/mmu/mmu.c | 9 ++++++--- > > 1 file changed, 6 insertions(+), 3 deletions(-) > > > > diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c > > index 51671cb34fb6..f296340803ba 100644 > > --- a/arch/x86/kvm/mmu/mmu.c > > +++ b/arch/x86/kvm/mmu/mmu.c > > @@ -1499,11 +1499,14 @@ static bool slot_rmap_walk_okay(struct slot_rmap_walk_iterator *iterator) > > return !!iterator->rmap; > > } > > > > -static void slot_rmap_walk_next(struct slot_rmap_walk_iterator *iterator) > > +static noinline void > > What is the reason to add noinline? My understanding is that since this method is called from __always_inline methods, noinline will avoid gcc inlining the slot_rmap_walk_next in those functions and generate smaller code.