All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Beulich <jbeulich@suse.com>
To: "xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
	George Dunlap <george.dunlap@citrix.com>,
	Ian Jackson <iwj@xenproject.org>, Julien Grall <julien@xen.org>,
	Stefano Stabellini <sstabellini@kernel.org>, Wei Liu <wl@xen.org>
Subject: [PATCH] gnttab: don't allocate status frame tracking array when "gnttab=max_ver:1"
Date: Thu, 5 Nov 2020 16:55:25 +0100	[thread overview]
Message-ID: <a484cc88-f41d-5d38-d098-4eda297569a1@suse.com> (raw)

This array can be large when many grant frames are permitted; avoid
allocating it when it's not going to be used anyway. Do so indirectly
though, by making grant_to_status_frames() return zero in this case.

Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/xen/common/grant_table.c
+++ b/xen/common/grant_table.c
@@ -446,11 +446,14 @@ static inline void active_entry_release(
 
 static inline unsigned int grant_to_status_frames(unsigned int grant_frames)
 {
+    if ( opt_gnttab_max_version < 2 )
+        return 0;
     return DIV_ROUND_UP(grant_frames * GRANT_PER_PAGE, GRANT_STATUS_PER_PAGE);
 }
 
 static inline unsigned int status_to_grant_frames(unsigned int status_frames)
 {
+    ASSERT(opt_gnttab_max_version >= 2);
     return DIV_ROUND_UP(status_frames * GRANT_STATUS_PER_PAGE, GRANT_PER_PAGE);
 }
 


             reply	other threads:[~2020-11-05 15:55 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-05 15:55 Jan Beulich [this message]
2020-11-20 12:50 ` Ping: [PATCH] gnttab: don't allocate status frame tracking array when "gnttab=max_ver:1" Jan Beulich
2020-12-02 18:31 ` Julien Grall
2020-12-04 10:02   ` Jan Beulich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a484cc88-f41d-5d38-d098-4eda297569a1@suse.com \
    --to=jbeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=george.dunlap@citrix.com \
    --cc=iwj@xenproject.org \
    --cc=julien@xen.org \
    --cc=sstabellini@kernel.org \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.