search for: array_alloc_order

Displaying 16 results from an estimated 16 matches for "array_alloc_order".

2018 Jun 26
2
[PATCH v34 2/4] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_HINT
...44 > --- a/drivers/virtio/virtio_balloon.c > +++ b/drivers/virtio/virtio_balloon.c > @@ -43,6 +43,11 @@ > #define OOM_VBALLOON_DEFAULT_PAGES 256 > #define VIRTBALLOON_OOM_NOTIFY_PRIORITY 80 > > +/* The order used to allocate an array to load free page hints */ > +#define ARRAY_ALLOC_ORDER (MAX_ORDER - 1) > +/* The size of an array in bytes */ > +#define ARRAY_ALLOC_SIZE ((1 << ARRAY_ALLOC_ORDER) << PAGE_SHIFT) > + Pls prefix macros so we can figure out they are local ones. > static int oom_pages = OOM_VBALLOON_DEFAULT_PAGES; > module_param(oom_pages,...
2018 Jun 26
2
[PATCH v34 2/4] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_HINT
...44 > --- a/drivers/virtio/virtio_balloon.c > +++ b/drivers/virtio/virtio_balloon.c > @@ -43,6 +43,11 @@ > #define OOM_VBALLOON_DEFAULT_PAGES 256 > #define VIRTBALLOON_OOM_NOTIFY_PRIORITY 80 > > +/* The order used to allocate an array to load free page hints */ > +#define ARRAY_ALLOC_ORDER (MAX_ORDER - 1) > +/* The size of an array in bytes */ > +#define ARRAY_ALLOC_SIZE ((1 << ARRAY_ALLOC_ORDER) << PAGE_SHIFT) > + Pls prefix macros so we can figure out they are local ones. > static int oom_pages = OOM_VBALLOON_DEFAULT_PAGES; > module_param(oom_pages,...
2018 Jun 25
0
[PATCH v34 2/4] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_HINT
...io_balloon.c index 6b237e3..d05f0ba 100644 --- a/drivers/virtio/virtio_balloon.c +++ b/drivers/virtio/virtio_balloon.c @@ -43,6 +43,11 @@ #define OOM_VBALLOON_DEFAULT_PAGES 256 #define VIRTBALLOON_OOM_NOTIFY_PRIORITY 80 +/* The order used to allocate an array to load free page hints */ +#define ARRAY_ALLOC_ORDER (MAX_ORDER - 1) +/* The size of an array in bytes */ +#define ARRAY_ALLOC_SIZE ((1 << ARRAY_ALLOC_ORDER) << PAGE_SHIFT) + static int oom_pages = OOM_VBALLOON_DEFAULT_PAGES; module_param(oom_pages, int, S_IRUSR | S_IWUSR); MODULE_PARM_DESC(oom_pages, "pages to free on OOM");...
2018 Jun 27
2
[PATCH v34 2/4] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_HINT
...tter. > > > > > > Best, > > > Wei > > How much memory is this allocating anyway? > > > > For every 2TB memory that the guest has, we allocate 4MB. Hmm I guess I'm missing something, I don't see it: + max_entries = max_free_page_blocks(ARRAY_ALLOC_ORDER); + entries_per_page = PAGE_SIZE / sizeof(__le64); + entries_per_array = entries_per_page * (1 << ARRAY_ALLOC_ORDER); + max_array_num = max_entries / entries_per_array + + !!(max_entries % entries_per_array); Looks like you always allocate the max numb...
2018 Jun 27
2
[PATCH v34 2/4] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_HINT
...tter. > > > > > > Best, > > > Wei > > How much memory is this allocating anyway? > > > > For every 2TB memory that the guest has, we allocate 4MB. Hmm I guess I'm missing something, I don't see it: + max_entries = max_free_page_blocks(ARRAY_ALLOC_ORDER); + entries_per_page = PAGE_SIZE / sizeof(__le64); + entries_per_array = entries_per_page * (1 << ARRAY_ALLOC_ORDER); + max_array_num = max_entries / entries_per_array + + !!(max_entries % entries_per_array); Looks like you always allocate the max numb...
2018 Jun 27
2
[PATCH v34 2/4] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_HINT
...gt; > > > How much memory is this allocating anyway? > > > > > > > For every 2TB memory that the guest has, we allocate 4MB. > > Hmm I guess I'm missing something, I don't see it: > > > > > > + max_entries = max_free_page_blocks(ARRAY_ALLOC_ORDER); > > + entries_per_page = PAGE_SIZE / sizeof(__le64); > > + entries_per_array = entries_per_page * (1 << ARRAY_ALLOC_ORDER); > > + max_array_num = max_entries / entries_per_array + > > + !!(max_entries % entries_per_array); >...
2018 Jun 27
2
[PATCH v34 2/4] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_HINT
...gt; > > > How much memory is this allocating anyway? > > > > > > > For every 2TB memory that the guest has, we allocate 4MB. > > Hmm I guess I'm missing something, I don't see it: > > > > > > + max_entries = max_free_page_blocks(ARRAY_ALLOC_ORDER); > > + entries_per_page = PAGE_SIZE / sizeof(__le64); > > + entries_per_array = entries_per_page * (1 << ARRAY_ALLOC_ORDER); > > + max_array_num = max_entries / entries_per_array + > > + !!(max_entries % entries_per_array); >...
2018 Jun 26
0
[PATCH v34 2/4] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_HINT
...t;cmd_stop) >> + break; > If there's any buffer after this one we might never get another > callback. I think every used buffer can get the callback, because host takes from the arrays one by one, and puts back each with a vq notify. >> + free_pages((unsigned long)buf, ARRAY_ALLOC_ORDER); >> + } >> +} >> + >> static int init_vqs(struct virtio_balloon *vb) >> { >> - struct virtqueue *vqs[3]; >> - vq_callback_t *callbacks[] = { balloon_ack, balloon_ack, stats_request }; >> - static const char * const names[] = { "inflate"...
2018 Jun 25
9
[PATCH v34 0/4] Virtio-balloon: support free page reporting
This patch series is separated from the previous "Virtio-balloon Enhancement" series. The new feature, VIRTIO_BALLOON_F_FREE_PAGE_HINT, implemented by this series enables the virtio-balloon driver to report hints of guest free pages to the host. It can be used to accelerate live migration of VMs. Here is an introduction of this usage: Live migration needs to transfer the VM's
2018 Jun 25
9
[PATCH v34 0/4] Virtio-balloon: support free page reporting
This patch series is separated from the previous "Virtio-balloon Enhancement" series. The new feature, VIRTIO_BALLOON_F_FREE_PAGE_HINT, implemented by this series enables the virtio-balloon driver to report hints of guest free pages to the host. It can be used to accelerate live migration of VMs. Here is an introduction of this usage: Live migration needs to transfer the VM's
2018 Jun 26
2
[PATCH v34 2/4] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_HINT
...ery used buffer can get the callback, because host takes from the > arrays one by one, and puts back each with a vq notify. It's probabky racy even in this case. Besides, host is free to do it in any way that's legal in spec. > > > > > + free_pages((unsigned long)buf, ARRAY_ALLOC_ORDER); > > > + } > > > +} > > > + > > > static int init_vqs(struct virtio_balloon *vb) > > > { > > > - struct virtqueue *vqs[3]; > > > - vq_callback_t *callbacks[] = { balloon_ack, balloon_ack, stats_request }; > > > - static co...
2018 Jun 26
2
[PATCH v34 2/4] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_HINT
...ery used buffer can get the callback, because host takes from the > arrays one by one, and puts back each with a vq notify. It's probabky racy even in this case. Besides, host is free to do it in any way that's legal in spec. > > > > > + free_pages((unsigned long)buf, ARRAY_ALLOC_ORDER); > > > + } > > > +} > > > + > > > static int init_vqs(struct virtio_balloon *vb) > > > { > > > - struct virtqueue *vqs[3]; > > > - vq_callback_t *callbacks[] = { balloon_ack, balloon_ack, stats_request }; > > > - static co...
2018 Jun 27
0
[PATCH v34 2/4] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_HINT
...t;>>> Best, >>>> Wei >>> How much memory is this allocating anyway? >>> >> For every 2TB memory that the guest has, we allocate 4MB. > Hmm I guess I'm missing something, I don't see it: > > > + max_entries = max_free_page_blocks(ARRAY_ALLOC_ORDER); > + entries_per_page = PAGE_SIZE / sizeof(__le64); > + entries_per_array = entries_per_page * (1 << ARRAY_ALLOC_ORDER); > + max_array_num = max_entries / entries_per_array + > + !!(max_entries % entries_per_array); > > Looks like you...
2018 Jun 27
0
[PATCH v34 2/4] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_HINT
...t;> How much memory is this allocating anyway? >>>>> >>>> For every 2TB memory that the guest has, we allocate 4MB. >>> Hmm I guess I'm missing something, I don't see it: >>> >>> >>> + max_entries = max_free_page_blocks(ARRAY_ALLOC_ORDER); >>> + entries_per_page = PAGE_SIZE / sizeof(__le64); >>> + entries_per_array = entries_per_page * (1 << ARRAY_ALLOC_ORDER); >>> + max_array_num = max_entries / entries_per_array + >>> + !!(max_entries % entries_per_...
2018 Jun 26
2
[PATCH v34 2/4] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_HINT
On Tue, Jun 26, 2018 at 08:27:44PM +0800, Wei Wang wrote: > On 06/26/2018 11:56 AM, Michael S. Tsirkin wrote: > > On Tue, Jun 26, 2018 at 11:46:35AM +0800, Wei Wang wrote: > > > > > > > > > > > > > > > + if (!arrays) > > > > > + return NULL; > > > > > + > > > > > + for (i = 0; i <
2018 Jun 26
2
[PATCH v34 2/4] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_HINT
On Tue, Jun 26, 2018 at 08:27:44PM +0800, Wei Wang wrote: > On 06/26/2018 11:56 AM, Michael S. Tsirkin wrote: > > On Tue, Jun 26, 2018 at 11:46:35AM +0800, Wei Wang wrote: > > > > > > > > > > > > > > > + if (!arrays) > > > > > + return NULL; > > > > > + > > > > > + for (i = 0; i <