* [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
* Ping: [PATCH] gnttab: don't allocate status frame tracking array when "gnttab=max_ver:1"
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 ` Jan Beulich
2020-12-02 18:31 ` Julien Grall
1 sibling, 0 replies; 4+ messages in thread
From: Jan Beulich @ 2020-11-20 12:50 UTC (permalink / raw)
To: Andrew Cooper, George Dunlap, Julien Grall, Stefano Stabellini, Wei Liu
Cc: Ian Jackson, xen-devel
On 05.11.2020 16:55, Jan Beulich wrote:
> 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>
Ping?
> --- 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
* Re: [PATCH] gnttab: don't allocate status frame tracking array when "gnttab=max_ver:1"
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
1 sibling, 1 reply; 4+ messages in thread
From: Julien Grall @ 2020-12-02 18:31 UTC (permalink / raw)
To: Jan Beulich, xen-devel
Cc: Andrew Cooper, George Dunlap, Ian Jackson, Stefano Stabellini, Wei Liu
Hi Jan,
On 05/11/2020 15:55, Jan Beulich wrote:
> This array can be large when many grant frames are permitted; avoid
> allocating it when it's not going to be used anyway.
Given there are not many users of grant-table v2, would it make sense to
avoid allocating the array until the guest start using grant-table v2?
Cheers,
--
Julien Grall
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] gnttab: don't allocate status frame tracking array when "gnttab=max_ver:1"
2020-12-02 18:31 ` Julien Grall
@ 2020-12-04 10:02 ` Jan Beulich
0 siblings, 0 replies; 4+ messages in thread
From: Jan Beulich @ 2020-12-04 10:02 UTC (permalink / raw)
To: Julien Grall
Cc: Andrew Cooper, George Dunlap, Ian Jackson, Stefano Stabellini,
Wei Liu, xen-devel
On 02.12.2020 19:31, Julien Grall wrote:
> On 05/11/2020 15:55, Jan Beulich wrote:
>> This array can be large when many grant frames are permitted; avoid
>> allocating it when it's not going to be used anyway.
>
> Given there are not many users of grant-table v2, would it make sense to
> avoid allocating the array until the guest start using grant-table v2?
Hmm, yes, seems possible. Let me give this a try.
Jan
^ 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.