Received: by 2002:a05:6602:2086:0:0:0:0 with SMTP id a6csp4434135ioa; Wed, 27 Apr 2022 03:55:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzDqL0D997fw4wUM+/ri6vWytbg0CMp5mxlLJV7inl9Em7PH8C//5kH59xI9bNkWsqV23Rg X-Received: by 2002:a17:90a:c302:b0:1d9:8222:c9a5 with SMTP id g2-20020a17090ac30200b001d98222c9a5mr15399192pjt.74.1651056915779; Wed, 27 Apr 2022 03:55:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651056915; cv=none; d=google.com; s=arc-20160816; b=hrgaFGrbdbKlEKQ+K+PoorrGrofu59Ik38vJ5fQkHbtghU7/JKLHXCBLS4htY61urE hBb2n1n94xh4asfTMZFIIL3x/2UdGfWRTRX+lyp4D6NVKNneQHGWZlKDvGxhTnYSzpOe /DwbJMYFTfhIHHVCnh62cX0agmeSRISc4a+eaQIkB9xkT5A6P7CSflV8KHI5IJTb/t/m vbcnbYZ3pX88TLlJHbToxdkzMSS6MUXymqQuAVWMGt6JPQlfNlDJCyqA/MrPlma6nq1C ZB9883J0GMk25zO/tQnwop0vJrLNqREdIChj70ZXLopgsY8Z/+tFlFVL155W4T2GEEz1 GJ9g== 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=aU1nfmW7ZgdT9Qa1tRExDdIJcvLzr/71e6MMUKD+f14=; b=vFDGO4SqwLOhCvb1gxd6BgtpMiUvqCfQV0vl6UWbRKsWDqD4bYDRY/ijkzAbS+kCvk 2GpkPZCcC0pOio5CHrz+jF5WUBJ75kcaJNfCz9z1SYu9oi9oJf01BwxeaejtuV7b/p35 hQIESm03MPxqU4gqGASzooYQH77M4fAE8kHP06l5R5GyZfjZCHEG7v1Sx1gaC1xxgNWn w9cF5c6VgI8iVmqqc+M6N56lNNiWn4c/OUT05sPD+cUhaAeqp2bDwDPYy6uLQuJbv/fB wIUKuTbo7PML15vFjk48TnOYK7tcXPwgg7O6uf0EVadkUeOUc9SOtb781rDViYXYxb9m R9Lw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b="L+04/VSv"; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id 73-20020a63004c000000b003821f536216si1131020pga.578.2022.04.27.03.55.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Apr 2022 03:55:15 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b="L+04/VSv"; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id B338159311; Wed, 27 Apr 2022 03:00:23 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355045AbiDZUhV (ORCPT + 99 others); Tue, 26 Apr 2022 16:37:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47806 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355030AbiDZUhK (ORCPT ); Tue, 26 Apr 2022 16:37:10 -0400 Received: from mail-lj1-x22d.google.com (mail-lj1-x22d.google.com [IPv6:2a00:1450:4864:20::22d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 915431A8C22 for ; Tue, 26 Apr 2022 13:34:01 -0700 (PDT) Received: by mail-lj1-x22d.google.com with SMTP id 17so35401lji.1 for ; Tue, 26 Apr 2022 13:34:01 -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=aU1nfmW7ZgdT9Qa1tRExDdIJcvLzr/71e6MMUKD+f14=; b=L+04/VSvu1o2iLCXuaCNLPQgteB9nxjsaUItY80e35KA07eJCca0YXvYS8yXsehgAp gJwV1fDjZTTu27Nk2EVmh0GDdfERG/5DXk0qeuBgd2nFP0RDyeiTP1b0WfMuEAvcfEHQ tNSJqHRlQoAbQ+NR67QcpnTTT87zUPLTpmtpq5HgLEtmx0wlgRbbTaHwoTamu+Pq5W4W D27sEwR9kh+F0dh9lSZY4JSbb48iY4yOWiVIi/NMXsJh73r5t6XBQDJqfwbqLXCJk0Df uO9Z362RUBuDni5ds34LO1tG4fWsrgPKCw55j+7XUDm1gmZr9P4WjsNLa10eqM/3ZJwp vn7g== 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=aU1nfmW7ZgdT9Qa1tRExDdIJcvLzr/71e6MMUKD+f14=; b=8A1QsZJdp6V26RL+RKi2ZGzcI0VDobVMLzYjbJVnwPyPeA6JdGVu3cLQ6Twq5fd0RZ BBjjyPVv3S1sDgHaJdi85KRxeYxA6sLdmAnpNAB/9aLvLhEPZF6+LfGF07DjwZY9/R5x tg++sQhbRrLnxtu0zYs5WsaMZWfDnGOrP3nOxY0WyCHYXgeBixiAaI2BC/IgV6nd3y5w syp20DDo27MRX0eKtO2xQ3bOXOxYqXECCH4a46SL5t6sexo87ZcLopA8h95VI8cXo+bY nehqev33NLAu8rt8KR+1GuZsYEj6PAd1g5jHzZ1PPGS7HnvpxDtnyR+Vwuqm3o1sTID8 JtHQ== X-Gm-Message-State: AOAM532lskWcggTGkhG72jcbo7VtU+Q2xmURwesSc5YBoXu9RZ0+HIvj cxkyynI8f48xZbvTMCQlUeb6GV7LFerKJZ0KwKfOdA== X-Received: by 2002:a2e:97c7:0:b0:24f:5a7:f398 with SMTP id m7-20020a2e97c7000000b0024f05a7f398mr11417653ljj.231.1651005239369; Tue, 26 Apr 2022 13:33:59 -0700 (PDT) MIME-Version: 1.0 References: <20220325233125.413634-1-vipinsh@google.com> In-Reply-To: From: Vipin Sharma Date: Tue, 26 Apr 2022 13:33:23 -0700 Message-ID: Subject: Re: [PATCH] KVM: x86/mmu: Speed up slot_rmap_walk_next for sparsely populated rmaps To: Paolo Bonzini Cc: David Matlack , 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=-9.5 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,USER_IN_DEF_DKIM_WL autolearn=no 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, Apr 18, 2022 at 9:29 AM Vipin Sharma wrote: > > On Fri, Apr 8, 2022 at 12:31 PM Vipin Sharma wrote: > > > > On Sun, Mar 27, 2022 at 3:41 AM Paolo Bonzini wrote: > > > > > > On 3/26/22 01:31, Vipin Sharma wrote: > > > >>> -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. > > > > > > > > > > Iterators are written in such a way that it's way more beneficial to > > > inline them. After inlining, compilers replace the aggregates (in this > > > case, struct slot_rmap_walk_iterator) with one variable per field and > > > that in turn enables a lot of optimizations, so the iterators should > > > actually be always_inline if anything. > > > > > > For the same reason I'd guess the effect on the generated code should be > > > small (next time please include the output of "size mmu.o"), but should > > > still be there. I'll do a quick check of the generated code and apply > > > the patch. > > > > > > Paolo > > > > > > > Let me know if you are still planning to modify the current patch by > > removing "noinline" and merge or if you prefer a v2 without noinline. > > Hi Paolo, > > Any update on this patch? > Hi Paolo, Still waiting for your response on this patch :) Please let me know if you prefer v2 (without noinline) or you will merge this patch without noinline from your side. If there is any concern or feedback which I can address please let me know. Thanks Vipin Sharma