All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] gnttab: don't allocate status frame tracking array when "gnttab=max_ver:1"
@ 2020-11-05 15:55 Jan Beulich
  2020-11-20 12:50 ` Ping: " Jan Beulich
  2020-12-02 18:31 ` Julien Grall
  0 siblings, 2 replies; 4+ messages in thread
From: Jan Beulich @ 2020-11-05 15:55 UTC (permalink / raw)
  To: xen-devel
  Cc: Andrew Cooper, George Dunlap, Ian Jackson, Julien Grall,
	Stefano Stabellini, Wei Liu

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);
 }
 


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-12-04 10:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-05 15:55 [PATCH] gnttab: don't allocate status frame tracking array when "gnttab=max_ver:1" Jan Beulich
2020-11-20 12:50 ` Ping: " Jan Beulich
2020-12-02 18:31 ` Julien Grall
2020-12-04 10:02   ` Jan Beulich

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.