From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C1220C433F5 for ; Fri, 25 Mar 2022 08:34:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355186AbiCYIgO (ORCPT ); Fri, 25 Mar 2022 04:36:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46070 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351420AbiCYIgM (ORCPT ); Fri, 25 Mar 2022 04:36:12 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 23A3049F11 for ; Fri, 25 Mar 2022 01:34:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1648197278; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WrdyQb+Uv/9WNCCF+/twDW82DyGh5taXBM+hU8QrQjU=; b=G13UsxorlXqmpZ4PHnHy2S2gm2wDVakLQX1qexIG0xnnpyAN6I6RSvIuCnqiwYP1SN0JFV v7TKZcQ4FyBnC6BaSLJanf4SUnhXkE+B3qHC3Ye6Q3u2pu5GeY3c5LBCUGdPO1tSTvfH5f V5B3E1pO836KOJMzfWll2BPWo0Gb1Sw= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-122-5v8A_A3SOPWoIFuGiFe96w-1; Fri, 25 Mar 2022 04:34:37 -0400 X-MC-Unique: 5v8A_A3SOPWoIFuGiFe96w-1 Received: by mail-wm1-f69.google.com with SMTP id z16-20020a05600c0a1000b0038bebbd8548so4940730wmp.3 for ; Fri, 25 Mar 2022 01:34:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references :user-agent:reply-to:date:message-id:mime-version :content-transfer-encoding; bh=WrdyQb+Uv/9WNCCF+/twDW82DyGh5taXBM+hU8QrQjU=; b=aTDrF7mLr6oYBsrk+2VBAwjAkpJGUdIAINZKE6o18+tkjJlu0KN940ulF7KgCGb2iz oRhW2K2RvBsvbOQJ0eek6hKJQTxlCV9Ke27isL28NPTELrO3kOacy+Toy5AAFCiEmx0K z209sfiMswxYAWY17VHDj2FWGYnJap+TrVbcsBnEfZAhXy+I6M6kuc6pe3BMiCtT6zke SVWp06vGPoigN6ppnT0pTB0bL59gEOB+v5IyEiZLTdN4A/5CBWasMFw5ubxvxC8ujzl+ uT6aU20QdcllHAPu9MhNA7y2fi+pXhqyxcTYAY9FpqTmnRyS+C/MrbEDkmtBknclJO3v ye3Q== X-Gm-Message-State: AOAM531mfqqsGx8lyji+oQpQszSfn+mqcgd+1OWbHScKmupjEvgAeA31 eI9AwghYKnd3sEIuBHxoXKpKygSicFdgnIJNnk7Jg2ol4hbsKEcmRfkDk2++dtmhnKkFfAxFyez ZvycXOzDnHpNH X-Received: by 2002:a05:600c:35cc:b0:38c:6d25:f4ad with SMTP id r12-20020a05600c35cc00b0038c6d25f4admr8589601wmq.127.1648197275905; Fri, 25 Mar 2022 01:34:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy9JSpWRk2LRgPXv74WxLi/tJwLkB8FqTAgxuuKq0EB245CfQf7Z1SW9Vl2nq04SgzY/fLhZw== X-Received: by 2002:a05:600c:35cc:b0:38c:6d25:f4ad with SMTP id r12-20020a05600c35cc00b0038c6d25f4admr8589572wmq.127.1648197275657; Fri, 25 Mar 2022 01:34:35 -0700 (PDT) Received: from localhost ([47.63.10.52]) by smtp.gmail.com with ESMTPSA id n8-20020a5d5988000000b00203d5f1f3e4sm4828654wri.105.2022.03.25.01.34.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Mar 2022 01:34:35 -0700 (PDT) From: Juan Quintela To: marcandre.lureau@redhat.com Cc: qemu-devel@nongnu.org, Cameron Esfahani , Roman Bolshakov , Paolo Bonzini , David Hildenbrand , Igor Mammedov , Kevin Wolf , Hanna Reitz , Stefan Hajnoczi , Fam Zheng , Philippe =?utf-8?Q?Mathieu-Daud=C3=A9?= , "Denis V. Lunev" , Vladimir Sementsov-Ogievskiy , Warner Losh , Kyle Evans , "Michael S. Tsirkin" , Gerd Hoffmann , Eduardo Habkost , Marcel Apfelbaum , Yanan Wang , Cornelia Huck , Thomas Huth , Halil Pasic , Christian Borntraeger , Mark Cave-Ayland , =?utf-8?Q?C=C3=A9dric?= Le Goater , Daniel Henrique Barboza , David Gibson , Greg Kurz , Yuval Shaia , Stefan Berger , Alex Williamson , Richard Henderson , Peter Xu , Laurent Vivier , "Dr. David Alan Gilbert" , Markus Armbruster , Wenchao Wang , Colin Xu , Kamil Rytarowski , Reinoud Zandijk , Sunil Muthuswamy , Stefan Weil , kvm@vger.kernel.org (open list:Overall KVM CPUs), qemu-block@nongnu.org (open list:Block layer core), qemu-s390x@nongnu.org (open list:S390 general arch...), qemu-ppc@nongnu.org (open list:New World (mac99)), haxm-team@intel.com (open list:X86 HAXM CPUs) Subject: Re: [PATCH 11/32] Replace qemu_real_host_page variables with inlined functions In-Reply-To: <20220323155743.1585078-12-marcandre.lureau@redhat.com> (marcandre lureau's message of "Wed, 23 Mar 2022 19:57:22 +0400") References: <20220323155743.1585078-1-marcandre.lureau@redhat.com> <20220323155743.1585078-12-marcandre.lureau@redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) Reply-To: quintela@redhat.com Date: Fri, 25 Mar 2022 09:34:33 +0100 Message-ID: <87k0cie8h2.fsf@secure.mitica> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org marcandre.lureau@redhat.com wrote: > From: Marc-Andr=C3=A9 Lureau > > Replace the global variables with inlined helper functions. getpagesize()= is very > likely annotated with a "const" function attribute (at least with glibc),= and thus > optimization should apply even better. > > This avoids the need for a constructor initialization too. > > Signed-off-by: Marc-Andr=C3=A9 Lureau I see what you are tyring to do here. But once here, why aren't we just calling getpagesize() and call it a day? I can't see what advantage has to have this other name for this function, and as you are already changing all its uses anyways. Once there, I can see that qemu_real_host_page_mask is used (almost) everywhere as (vfio code use the real value): foo & qemu_real_host_page_mask() or foo & ~qemu_real_host_page_mask() And no, I don't have any good names for this macros. Anyways, if you don't like the suggestion, your changes are better that we already have, so ... Reviewed-by: Juan Quintela