Re: [PATCH v20 3/7 RESEND] xbitmap: add more operations

2018-01-03 Thread Wei Wang
On 01/02/2018 10:09 PM, Matthew Wilcox wrote: On Fri, Dec 22, 2017 at 04:49:11PM +0800, Wei Wang wrote: Thanks for the improvement. I also found a small bug in xb_zero. With the following changes, it has passed the current test cases and tested with the virtio-balloon usage without any issue

Re: [PATCH v20 3/7 RESEND] xbitmap: add more operations

2018-01-03 Thread Wei Wang
On 01/02/2018 10:09 PM, Matthew Wilcox wrote: On Fri, Dec 22, 2017 at 04:49:11PM +0800, Wei Wang wrote: Thanks for the improvement. I also found a small bug in xb_zero. With the following changes, it has passed the current test cases and tested with the virtio-balloon usage without any issue

Re: [PATCH v20 4/7] virtio-balloon: VIRTIO_BALLOON_F_SG

2017-12-26 Thread Wei Wang
On 12/26/2017 06:38 PM, Tetsuo Handa wrote: Wei Wang wrote: On 12/25/2017 10:51 PM, Tetsuo Handa wrote: Wei Wang wrote: What we are doing here is to free the pages that were just allocated in this round of inflating. Next round will be sometime later when the balloon work item gets its turn

Re: [PATCH v20 4/7] virtio-balloon: VIRTIO_BALLOON_F_SG

2017-12-26 Thread Wei Wang
On 12/26/2017 06:38 PM, Tetsuo Handa wrote: Wei Wang wrote: On 12/25/2017 10:51 PM, Tetsuo Handa wrote: Wei Wang wrote: What we are doing here is to free the pages that were just allocated in this round of inflating. Next round will be sometime later when the balloon work item gets its turn

Re: [PATCH v20 4/7] virtio-balloon: VIRTIO_BALLOON_F_SG

2017-12-25 Thread Wei Wang
On 12/25/2017 10:51 PM, Tetsuo Handa wrote: Wei Wang wrote: @@ -173,8 +292,15 @@ static unsigned fill_balloon(struct virtio_balloon *vb, size_t num) while ((page = balloon_page_pop())) { balloon_page_enqueue(>vb_dev_info, page); +if (use

Re: [PATCH v20 4/7] virtio-balloon: VIRTIO_BALLOON_F_SG

2017-12-25 Thread Wei Wang
On 12/25/2017 10:51 PM, Tetsuo Handa wrote: Wei Wang wrote: @@ -173,8 +292,15 @@ static unsigned fill_balloon(struct virtio_balloon *vb, size_t num) while ((page = balloon_page_pop())) { balloon_page_enqueue(>vb_dev_info, page); +if (use

Re: [virtio-dev] Re: [PATCH v20 4/7] virtio-balloon: VIRTIO_BALLOON_F_SG

2017-12-24 Thread Wei Wang
On 12/24/2017 03:42 PM, Wei Wang wrote: On 12/24/2017 12:45 PM, Tetsuo Handa wrote: Matthew Wilcox wrote: +unsigned long pfn = page_to_pfn(page); +int ret; + +*pfn_min = min(pfn, *pfn_min); +*pfn_max = max(pfn, *pfn_max); + +do { +if (xb_preload(GFP_NOWAIT

Re: [virtio-dev] Re: [PATCH v20 4/7] virtio-balloon: VIRTIO_BALLOON_F_SG

2017-12-24 Thread Wei Wang
On 12/24/2017 03:42 PM, Wei Wang wrote: On 12/24/2017 12:45 PM, Tetsuo Handa wrote: Matthew Wilcox wrote: +unsigned long pfn = page_to_pfn(page); +int ret; + +*pfn_min = min(pfn, *pfn_min); +*pfn_max = max(pfn, *pfn_max); + +do { +if (xb_preload(GFP_NOWAIT

Re: [PATCH v20 4/7] virtio-balloon: VIRTIO_BALLOON_F_SG

2017-12-23 Thread Wei Wang
On 12/24/2017 12:45 PM, Tetsuo Handa wrote: Matthew Wilcox wrote: + unsigned long pfn = page_to_pfn(page); + int ret; + + *pfn_min = min(pfn, *pfn_min); + *pfn_max = max(pfn, *pfn_max); + + do { + if (xb_preload(GFP_NOWAIT | __GFP_NOWARN) < 0) +

Re: [PATCH v20 4/7] virtio-balloon: VIRTIO_BALLOON_F_SG

2017-12-23 Thread Wei Wang
On 12/24/2017 12:45 PM, Tetsuo Handa wrote: Matthew Wilcox wrote: + unsigned long pfn = page_to_pfn(page); + int ret; + + *pfn_min = min(pfn, *pfn_min); + *pfn_max = max(pfn, *pfn_max); + + do { + if (xb_preload(GFP_NOWAIT | __GFP_NOWARN) < 0) +

Re: [PATCH v20 3/7 RESEND] xbitmap: add more operations

2017-12-23 Thread Wei Wang
On 12/23/2017 10:33 PM, Tetsuo Handa wrote: + bitmap = rcu_dereference_raw(*slot); + if (!bitmap) { + bitmap = this_cpu_xchg(ida_bitmap, NULL); + if (!bitmap) + return -ENOMEM; I can't understand this. I can understand if it were

Re: [PATCH v20 3/7 RESEND] xbitmap: add more operations

2017-12-23 Thread Wei Wang
On 12/23/2017 10:33 PM, Tetsuo Handa wrote: + bitmap = rcu_dereference_raw(*slot); + if (!bitmap) { + bitmap = this_cpu_xchg(ida_bitmap, NULL); + if (!bitmap) + return -ENOMEM; I can't understand this. I can understand if it were

Re: [PATCH v20 3/7 RESEND] xbitmap: add more operations

2017-12-22 Thread Wei Wang
On 12/22/2017 05:03 AM, Matthew Wilcox wrote: OK, here's a rewrite of xbitmap. Compared to the version you sent: - xb_find_set() is the rewrite I sent out yesterday. - xb_find_clear() is a new implementation. I use the IDR_FREE tag to find clear bits. This led to me finding a bug in

Re: [PATCH v20 3/7 RESEND] xbitmap: add more operations

2017-12-22 Thread Wei Wang
On 12/22/2017 05:03 AM, Matthew Wilcox wrote: OK, here's a rewrite of xbitmap. Compared to the version you sent: - xb_find_set() is the rewrite I sent out yesterday. - xb_find_clear() is a new implementation. I use the IDR_FREE tag to find clear bits. This led to me finding a bug in

Re: [PATCH v20 3/7 RESEND] xbitmap: add more operations

2017-12-22 Thread Wei Wang
On 12/21/2017 10:37 PM, Tetsuo Handa wrote: Matthew Wilcox wrote: +/** + * xb_find_set - find the next set bit in a range of bits + * @xb: the xbitmap to search from + * @offset: the offset in the range to start searching + * @size: the size of the range + * + * Returns: the found bit or, @size

Re: [PATCH v20 3/7 RESEND] xbitmap: add more operations

2017-12-22 Thread Wei Wang
On 12/21/2017 10:37 PM, Tetsuo Handa wrote: Matthew Wilcox wrote: +/** + * xb_find_set - find the next set bit in a range of bits + * @xb: the xbitmap to search from + * @offset: the offset in the range to start searching + * @size: the size of the range + * + * Returns: the found bit or, @size

Re: [PATCH v20 0/7] Virtio-balloon Enhancement

2017-12-20 Thread Wei Wang
On 12/21/2017 01:10 AM, Matthew Wilcox wrote: On Wed, Dec 20, 2017 at 04:13:16PM +, Wang, Wei W wrote: On Wednesday, December 20, 2017 8:26 PM, Matthew Wilcox wrote: unsigned long bit; xb_preload(GFP_KERNEL); xb_set_bit(xb, 700); xb_preload_end();

Re: [PATCH v20 0/7] Virtio-balloon Enhancement

2017-12-20 Thread Wei Wang
On 12/21/2017 01:10 AM, Matthew Wilcox wrote: On Wed, Dec 20, 2017 at 04:13:16PM +, Wang, Wei W wrote: On Wednesday, December 20, 2017 8:26 PM, Matthew Wilcox wrote: unsigned long bit; xb_preload(GFP_KERNEL); xb_set_bit(xb, 700); xb_preload_end();

[PATCH v20 3/7 RESEND] xbitmap: add more operations

2017-12-20 Thread Wei Wang
to help searching. Signed-off-by: Wei Wang <wei.w.w...@intel.com> Cc: Matthew Wilcox <mawil...@microsoft.com> Cc: Andrew Morton <a...@linux-foundation.org> Cc: Michal Hocko <mho...@kernel.org> Cc: Michael S. Tsirkin <m...@redhat.com> Cc: Tetsuo Handa <penguin-ker.

[PATCH v20 3/7 RESEND] xbitmap: add more operations

2017-12-20 Thread Wei Wang
to help searching. Signed-off-by: Wei Wang Cc: Matthew Wilcox Cc: Andrew Morton Cc: Michal Hocko Cc: Michael S. Tsirkin Cc: Tetsuo Handa Suggested-by: Matthew Wilcox --- include/linux/xbitmap.h | 6 ++ lib/xbitmap.c| 205

Re: [PATCH v20 0/7] Virtio-balloon Enhancement

2017-12-20 Thread Wei Wang
On 12/19/2017 10:05 PM, Tetsuo Handa wrote: Wei Wang wrote: ChangeLog: v19->v20: 1) patch 1: xbitmap - add __rcu to "void **slot"; - remove the exceptional path. 2) patch 3: xbitmap - DeveloperNotes: add an item to comment that the current bit range

Re: [PATCH v20 0/7] Virtio-balloon Enhancement

2017-12-20 Thread Wei Wang
On 12/19/2017 10:05 PM, Tetsuo Handa wrote: Wei Wang wrote: ChangeLog: v19->v20: 1) patch 1: xbitmap - add __rcu to "void **slot"; - remove the exceptional path. 2) patch 3: xbitmap - DeveloperNotes: add an item to comment that the current bit range

Re: dst refcount is -1

2017-12-19 Thread Wei Wang
On Tue, Dec 19, 2017 at 2:56 AM, Ortwin Glück wrote: > Hi, > > On 4.14.6 I just got this (on a busy firewall): > [Tue Dec 19 11:15:59 2017] dst_release: dst:9bb7aca0d6c0 refcnt:-1 > > Are you sure the refcounting is now correct? > > Ortwin Would you give more details under what

Re: dst refcount is -1

2017-12-19 Thread Wei Wang
On Tue, Dec 19, 2017 at 2:56 AM, Ortwin Glück wrote: > Hi, > > On 4.14.6 I just got this (on a busy firewall): > [Tue Dec 19 11:15:59 2017] dst_release: dst:9bb7aca0d6c0 refcnt:-1 > > Are you sure the refcounting is now correct? > > Ortwin Would you give more details under what circumstances

[PATCH v20 1/7] xbitmap: Introduce xbitmap

2017-12-19 Thread Wei Wang
st_bit(). Signed-off-by: Wei Wang <wei.w.w...@intel.com> Cc: Matthew Wilcox <mawil...@microsoft.com> Cc: Andrew Morton <a...@linux-foundation.org> Cc: Michal Hocko <mho...@kernel.org> Cc: Michael S. Tsirkin <m...@redhat.com> Cc: Tetsuo Handa <penguin-ker...@i-love.sakura

[PATCH v20 1/7] xbitmap: Introduce xbitmap

2017-12-19 Thread Wei Wang
From: Matthew Wilcox The eXtensible Bitmap is a sparse bitmap representation which is efficient for set bits which tend to cluster. It supports up to 'unsigned long' worth of bits, and this commit adds the bare bones -- xb_set_bit(), xb_clear_bit() and xb_test_bit(). Signed-off-by: Wei Wang

[PATCH v20 3/7] xbitmap: add more operations

2017-12-19 Thread Wei Wang
to help searching. Signed-off-by: Wei Wang <wei.w.w...@intel.com> Cc: Matthew Wilcox <mawil...@microsoft.com> Cc: Andrew Morton <a...@linux-foundation.org> Cc: Michal Hocko <mho...@kernel.org> Cc: Michael S. Tsirkin <m...@redhat.com> Cc: Tetsuo Handa <penguin-ker.

[PATCH v20 3/7] xbitmap: add more operations

2017-12-19 Thread Wei Wang
to help searching. Signed-off-by: Wei Wang Cc: Matthew Wilcox Cc: Andrew Morton Cc: Michal Hocko Cc: Michael S. Tsirkin Cc: Tetsuo Handa Suggested-by: Matthew Wilcox --- include/linux/xbitmap.h | 6 ++ lib/xbitmap.c| 198

[PATCH v20 7/7] virtio-balloon: don't report free pages when page poisoning is enabled

2017-12-19 Thread Wei Wang
adds a config field, poison_val. Guest writes to the config field to tell the host about the poisoning value. The value will be 0 in the following cases: 1) PAGE_POISONING_NO_SANITY is enabled; 2) page poisoning is disabled; or 3) PAGE_POISONING_ZERO is enabled. Signed-off-by: Wei Wang <wei.

[PATCH v20 7/7] virtio-balloon: don't report free pages when page poisoning is enabled

2017-12-19 Thread Wei Wang
adds a config field, poison_val. Guest writes to the config field to tell the host about the poisoning value. The value will be 0 in the following cases: 1) PAGE_POISONING_NO_SANITY is enabled; 2) page poisoning is disabled; or 3) PAGE_POISONING_ZERO is enabled. Signed-off-by: Wei Wang Suggested

[PATCH v20 5/7] mm: support reporting free page blocks

2017-12-19 Thread Wei Wang
ges but are written after the report function returns will be captured by the hypervisor, and they will be added to the next round of memory transfer. Signed-off-by: Wei Wang <wei.w.w...@intel.com> Signed-off-by: Liang Li <liang.z...@intel.com> Cc: Michal Hocko <mho...@kernel.org> C

[PATCH v20 5/7] mm: support reporting free page blocks

2017-12-19 Thread Wei Wang
ges but are written after the report function returns will be captured by the hypervisor, and they will be added to the next round of memory transfer. Signed-off-by: Wei Wang Signed-off-by: Liang Li Cc: Michal Hocko Cc: Michael S. Tsirkin Acked-by: Michal Hocko --- include/linux/mm.h | 6

[PATCH v20 2/7] xbitmap: potential improvement

2017-12-19 Thread Wei Wang
there, this will be a problem when inserting a node to the tree later. This patch moves __radix_tree_preload() after kmalloc() and returns a boolean to indicate the success or failure. Also, add the __must_check annotation to xb_preload for prudence purpose. Signed-off-by: Wei Wang <wei.w.w...@intel.com&

[PATCH v20 2/7] xbitmap: potential improvement

2017-12-19 Thread Wei Wang
there, this will be a problem when inserting a node to the tree later. This patch moves __radix_tree_preload() after kmalloc() and returns a boolean to indicate the success or failure. Also, add the __must_check annotation to xb_preload for prudence purpose. Signed-off-by: Wei Wang Cc: Matthew Wilcox Cc: Andrew

[PATCH v20 6/7] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_VQ

2017-12-19 Thread Wei Wang
the reporting in advance by sending the stop cmd id to the guest via the configuration register. Signed-off-by: Wei Wang <wei.w.w...@intel.com> Signed-off-by: Liang Li <liang.z...@intel.com> Cc: Michael S. Tsirkin <m...@redhat.com> Cc: Michal Hocko <mho...@kernel.org

[PATCH v20 6/7] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_VQ

2017-12-19 Thread Wei Wang
the reporting in advance by sending the stop cmd id to the guest via the configuration register. Signed-off-by: Wei Wang Signed-off-by: Liang Li Cc: Michael S. Tsirkin Cc: Michal Hocko --- drivers/virtio/virtio_balloon.c | 202 ++-- include/uapi/linux

[PATCH v20 4/7] virtio-balloon: VIRTIO_BALLOON_F_SG

2017-12-19 Thread Wei Wang
-by: Wei Wang <wei.w.w...@intel.com> Signed-off-by: Liang Li <liang.z...@intel.com> Suggested-by: Michael S. Tsirkin <m...@redhat.com> Cc: Tetsuo Handa <penguin-ker...@i-love.sakura.ne.jp> --- drivers/virtio/virtio_balloon.c | 234

[PATCH v20 0/7] Virtio-balloon Enhancement

2017-12-19 Thread Wei Wang
e-write the virtio-balloon implementation patch. 3) commit changes 4) patch re-org Matthew Wilcox (1): xbitmap: Introduce xbitmap Wei Wang (6): xbitmap: potential improvement xbitmap: add more operations virtio-balloon: VIRTIO_BALLOON_F_SG mm: support reporting free page blocks virtio-ba

[PATCH v20 4/7] virtio-balloon: VIRTIO_BALLOON_F_SG

2017-12-19 Thread Wei Wang
-by: Wei Wang Signed-off-by: Liang Li Suggested-by: Michael S. Tsirkin Cc: Tetsuo Handa --- drivers/virtio/virtio_balloon.c | 234 +--- include/uapi/linux/virtio_balloon.h | 1 + 2 files changed, 217 insertions(+), 18 deletions(-) diff --git a/drivers

[PATCH v20 0/7] Virtio-balloon Enhancement

2017-12-19 Thread Wei Wang
e-write the virtio-balloon implementation patch. 3) commit changes 4) patch re-org Matthew Wilcox (1): xbitmap: Introduce xbitmap Wei Wang (6): xbitmap: potential improvement xbitmap: add more operations virtio-balloon: VIRTIO_BALLOON_F_SG mm: support reporting free page blocks virtio-ba

Re: [PATCH v19 3/7] xbitmap: add more operations

2017-12-18 Thread Wei Wang
On 12/17/2017 11:16 PM, Tetsuo Handa wrote: Wang, Wei W wrote: Wei Wang wrote: But passing GFP_NOWAIT means that we can handle allocation failure. There is no need to use preload approach when we can handle allocation failure. I think the reason we need xb_preload is because radix tree

Re: [PATCH v19 3/7] xbitmap: add more operations

2017-12-18 Thread Wei Wang
On 12/17/2017 11:16 PM, Tetsuo Handa wrote: Wang, Wei W wrote: Wei Wang wrote: But passing GFP_NOWAIT means that we can handle allocation failure. There is no need to use preload approach when we can handle allocation failure. I think the reason we need xb_preload is because radix tree

Re: [PATCH v19 3/7] xbitmap: add more operations

2017-12-17 Thread Wei Wang
On 12/18/2017 06:18 AM, Matthew Wilcox wrote: On Sun, Dec 17, 2017 at 01:47:21PM +, Wang, Wei W wrote: On Saturday, December 16, 2017 3:22 AM, Matthew Wilcox wrote: On Fri, Dec 15, 2017 at 10:49:15AM -0800, Matthew Wilcox wrote: - xbit_clear() can't return an error. Neither can

Re: [PATCH v19 3/7] xbitmap: add more operations

2017-12-17 Thread Wei Wang
On 12/18/2017 06:18 AM, Matthew Wilcox wrote: On Sun, Dec 17, 2017 at 01:47:21PM +, Wang, Wei W wrote: On Saturday, December 16, 2017 3:22 AM, Matthew Wilcox wrote: On Fri, Dec 15, 2017 at 10:49:15AM -0800, Matthew Wilcox wrote: - xbit_clear() can't return an error. Neither can

Re: [PATCH v19 3/7] xbitmap: add more operations

2017-12-16 Thread Wei Wang
On 12/16/2017 07:28 PM, Tetsuo Handa wrote: Wei Wang wrote: On 12/16/2017 02:42 AM, Matthew Wilcox wrote: On Tue, Dec 12, 2017 at 07:55:55PM +0800, Wei Wang wrote: +int xb_preload_and_set_bit(struct xb *xb, unsigned long bit, gfp_t gfp); I'm struggling to understand when one would use

Re: [PATCH v19 3/7] xbitmap: add more operations

2017-12-16 Thread Wei Wang
On 12/16/2017 07:28 PM, Tetsuo Handa wrote: Wei Wang wrote: On 12/16/2017 02:42 AM, Matthew Wilcox wrote: On Tue, Dec 12, 2017 at 07:55:55PM +0800, Wei Wang wrote: +int xb_preload_and_set_bit(struct xb *xb, unsigned long bit, gfp_t gfp); I'm struggling to understand when one would use

Re: [PATCH v19 3/7] xbitmap: add more operations

2017-12-16 Thread Wei Wang
On 12/15/2017 12:29 AM, Tetsuo Handa wrote: Wei Wang wrote: I used the example of xb_clear_bit_range(), and xb_find_next_bit() is the same fundamentally. Please let me know if anywhere still looks fuzzy. I don't think it is the same for xb_find_next_bit() with set == 0

Re: [PATCH v19 3/7] xbitmap: add more operations

2017-12-16 Thread Wei Wang
On 12/15/2017 12:29 AM, Tetsuo Handa wrote: Wei Wang wrote: I used the example of xb_clear_bit_range(), and xb_find_next_bit() is the same fundamentally. Please let me know if anywhere still looks fuzzy. I don't think it is the same for xb_find_next_bit() with set == 0

Re: [PATCH v19 3/7] xbitmap: add more operations

2017-12-16 Thread Wei Wang
On 12/16/2017 02:42 AM, Matthew Wilcox wrote: On Tue, Dec 12, 2017 at 07:55:55PM +0800, Wei Wang wrote: +int xb_preload_and_set_bit(struct xb *xb, unsigned long bit, gfp_t gfp); I'm struggling to understand when one would use this. The xb_ API requires you to handle your own locking

Re: [PATCH v19 3/7] xbitmap: add more operations

2017-12-16 Thread Wei Wang
On 12/16/2017 02:42 AM, Matthew Wilcox wrote: On Tue, Dec 12, 2017 at 07:55:55PM +0800, Wei Wang wrote: +int xb_preload_and_set_bit(struct xb *xb, unsigned long bit, gfp_t gfp); I'm struggling to understand when one would use this. The xb_ API requires you to handle your own locking

Re: [PATCH v19 1/7] xbitmap: Introduce xbitmap

2017-12-16 Thread Wei Wang
On 12/15/2017 09:24 PM, Matthew Wilcox wrote: On Fri, Dec 15, 2017 at 07:05:07PM +0800, kbuild test robot wrote: 21 struct radix_tree_node *node; 22 void **slot; ^^^ missing __rcu annotation here. Wei, could you fold that change into

Re: [PATCH v19 1/7] xbitmap: Introduce xbitmap

2017-12-16 Thread Wei Wang
On 12/15/2017 09:24 PM, Matthew Wilcox wrote: On Fri, Dec 15, 2017 at 07:05:07PM +0800, kbuild test robot wrote: 21 struct radix_tree_node *node; 22 void **slot; ^^^ missing __rcu annotation here. Wei, could you fold that change into

Re: [virtio-dev] Re: [PATCH v19 3/7] xbitmap: add more operations

2017-12-14 Thread Wei Wang
On 12/14/2017 11:47 AM, Wei Wang wrote: On 12/13/2017 10:16 PM, Tetsuo Handa wrote: if (set) ret = find_next_bit(, BITS_PER_LONG, ebit); else ret = find_next_zero_bit

Re: [virtio-dev] Re: [PATCH v19 3/7] xbitmap: add more operations

2017-12-14 Thread Wei Wang
On 12/14/2017 11:47 AM, Wei Wang wrote: On 12/13/2017 10:16 PM, Tetsuo Handa wrote: if (set) ret = find_next_bit(, BITS_PER_LONG, ebit); else ret = find_next_zero_bit

Re: [PATCH v19 3/7] xbitmap: add more operations

2017-12-13 Thread Wei Wang
On 12/13/2017 10:16 PM, Tetsuo Handa wrote: Wei Wang wrote: On 12/12/2017 09:20 PM, Tetsuo Handa wrote: Wei Wang wrote: +void xb_clear_bit_range(struct xb *xb, unsigned long start, unsigned long end) +{ + struct radix_tree_root *root = >xbrt; + struct radix_tree_node *n

Re: [PATCH v19 3/7] xbitmap: add more operations

2017-12-13 Thread Wei Wang
On 12/13/2017 10:16 PM, Tetsuo Handa wrote: Wei Wang wrote: On 12/12/2017 09:20 PM, Tetsuo Handa wrote: Wei Wang wrote: +void xb_clear_bit_range(struct xb *xb, unsigned long start, unsigned long end) +{ + struct radix_tree_root *root = >xbrt; + struct radix_tree_node *n

Re: [PATCH v19 3/7] xbitmap: add more operations

2017-12-13 Thread Wei Wang
On 12/12/2017 09:20 PM, Tetsuo Handa wrote: Wei Wang wrote: +void xb_clear_bit_range(struct xb *xb, unsigned long start, unsigned long end) +{ + struct radix_tree_root *root = >xbrt; + struct radix_tree_node *node; + void **slot; + struct ida_bitmap *bit

Re: [PATCH v19 3/7] xbitmap: add more operations

2017-12-13 Thread Wei Wang
On 12/12/2017 09:20 PM, Tetsuo Handa wrote: Wei Wang wrote: +void xb_clear_bit_range(struct xb *xb, unsigned long start, unsigned long end) +{ + struct radix_tree_root *root = >xbrt; + struct radix_tree_node *node; + void **slot; + struct ida_bitmap *bit

Re: [PATCH v18 10/10] virtio-balloon: don't report free pages when page poisoning is enabled

2017-12-12 Thread Wei Wang
On 12/11/2017 09:24 PM, Michael S. Tsirkin wrote: On Mon, Dec 11, 2017 at 02:38:45PM +0800, Wei Wang wrote: On 12/01/2017 11:49 PM, Michael S. Tsirkin wrote: On Wed, Nov 29, 2017 at 09:55:26PM +0800, Wei Wang wrote: The guest free pages should not be discarded by the live migration thread

Re: [PATCH v18 10/10] virtio-balloon: don't report free pages when page poisoning is enabled

2017-12-12 Thread Wei Wang
On 12/11/2017 09:24 PM, Michael S. Tsirkin wrote: On Mon, Dec 11, 2017 at 02:38:45PM +0800, Wei Wang wrote: On 12/01/2017 11:49 PM, Michael S. Tsirkin wrote: On Wed, Nov 29, 2017 at 09:55:26PM +0800, Wei Wang wrote: The guest free pages should not be discarded by the live migration thread

[PATCH v19 0/7] Virtio-balloon Enhancement

2017-12-12 Thread Wei Wang
CHUNKS and VIRTIO_BALLOON_F_MISC_VQ, which were mixed together in the previous implementation; 2) Simpler function to get the free page block. v7->v8: 1) Use only one chunk format, instead of two. 2) re-write the virtio-balloon implementation patch. 3) commit changes 4) patch re-org Matthew Wilcox (1):

[PATCH v19 0/7] Virtio-balloon Enhancement

2017-12-12 Thread Wei Wang
CHUNKS and VIRTIO_BALLOON_F_MISC_VQ, which were mixed together in the previous implementation; 2) Simpler function to get the free page block. v7->v8: 1) Use only one chunk format, instead of two. 2) re-write the virtio-balloon implementation patch. 3) commit changes 4) patch re-org Matthew Wilcox (1):

[PATCH v19 2/7] xbitmap: potential improvement

2017-12-12 Thread Wei Wang
x_tree_preload() after kmalloc() and returns a boolean to indicate the success or failure. Also, add the __must_check annotation to xb_preload for prudence purpose. Signed-off-by: Wei Wang <wei.w.w...@intel.com> Cc: Matthew Wilcox <mawil...@microsoft.com> Cc: Andrew Morton <a...@

[PATCH v19 2/7] xbitmap: potential improvement

2017-12-12 Thread Wei Wang
x_tree_preload() after kmalloc() and returns a boolean to indicate the success or failure. Also, add the __must_check annotation to xb_preload for prudence purpose. Signed-off-by: Wei Wang Cc: Matthew Wilcox Cc: Andrew Morton Cc: Michal Hocko Cc: Michael S. Tsirkin Cc: Tetsuo Handa ---

[PATCH v19 1/7] xbitmap: Introduce xbitmap

2017-12-12 Thread Wei Wang
st_bit(). Signed-off-by: Wei Wang <wei.w.w...@intel.com> Cc: Matthew Wilcox <mawil...@microsoft.com> Cc: Andrew Morton <a...@linux-foundation.org> Cc: Michal Hocko <mho...@kernel.org> Cc: Michael S. Tsirkin <m...@redhat.com> Cc: Tetsuo Handa <penguin-ker...@i-love.sakura

[PATCH v19 3/7] xbitmap: add more operations

2017-12-12 Thread Wei Wang
to help searching. Signed-off-by: Wei Wang <wei.w.w...@intel.com> Cc: Matthew Wilcox <mawil...@microsoft.com> Cc: Andrew Morton <a...@linux-foundation.org> Cc: Michal Hocko <mho...@kernel.org> Cc: Michael S. Tsirkin <m...@redhat.com> Cc: Tetsuo Handa <penguin-ker.

[PATCH v19 1/7] xbitmap: Introduce xbitmap

2017-12-12 Thread Wei Wang
From: Matthew Wilcox The eXtensible Bitmap is a sparse bitmap representation which is efficient for set bits which tend to cluster. It supports up to 'unsigned long' worth of bits, and this commit adds the bare bones -- xb_set_bit(), xb_clear_bit() and xb_test_bit(). Signed-off-by: Wei Wang

[PATCH v19 3/7] xbitmap: add more operations

2017-12-12 Thread Wei Wang
to help searching. Signed-off-by: Wei Wang Cc: Matthew Wilcox Cc: Andrew Morton Cc: Michal Hocko Cc: Michael S. Tsirkin Cc: Tetsuo Handa Suggested-by: Matthew Wilcox --- include/linux/xbitmap.h | 8 +- lib/xbitmap.c| 229

[PATCH v19 6/7] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_VQ

2017-12-12 Thread Wei Wang
the reporting in advance by sending the stop cmd id to the guest via the configuration register. Signed-off-by: Wei Wang <wei.w.w...@intel.com> Signed-off-by: Liang Li <liang.z...@intel.com> Cc: Michael S. Tsirkin <m...@redhat.com> Cc: Michal Hocko <mho...@kernel.org

[PATCH v19 7/7] virtio-balloon: don't report free pages when page poisoning is enabled

2017-12-12 Thread Wei Wang
adds a config field, poison_val. Guest writes to the config field to tell the host about the poisoning value. The value will be 0 in the following cases: 1) PAGE_POISONING_NO_SANITY is enabled; 2) page poisoning is disabled; or 3) PAGE_POISONING_ZERO is enabled. Signed-off-by: Wei Wang <wei.

[PATCH v19 5/7] mm: support reporting free page blocks

2017-12-12 Thread Wei Wang
ges but are written after the report function returns will be captured by the hypervisor, and they will be added to the next round of memory transfer. Signed-off-by: Wei Wang <wei.w.w...@intel.com> Signed-off-by: Liang Li <liang.z...@intel.com> Cc: Michal Hocko <mho...@kernel.org> C

[PATCH v19 6/7] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_VQ

2017-12-12 Thread Wei Wang
the reporting in advance by sending the stop cmd id to the guest via the configuration register. Signed-off-by: Wei Wang Signed-off-by: Liang Li Cc: Michael S. Tsirkin Cc: Michal Hocko --- drivers/virtio/virtio_balloon.c | 202 ++-- include/uapi/linux

[PATCH v19 7/7] virtio-balloon: don't report free pages when page poisoning is enabled

2017-12-12 Thread Wei Wang
adds a config field, poison_val. Guest writes to the config field to tell the host about the poisoning value. The value will be 0 in the following cases: 1) PAGE_POISONING_NO_SANITY is enabled; 2) page poisoning is disabled; or 3) PAGE_POISONING_ZERO is enabled. Signed-off-by: Wei Wang Suggested

[PATCH v19 5/7] mm: support reporting free page blocks

2017-12-12 Thread Wei Wang
ges but are written after the report function returns will be captured by the hypervisor, and they will be added to the next round of memory transfer. Signed-off-by: Wei Wang Signed-off-by: Liang Li Cc: Michal Hocko Cc: Michael S. Tsirkin Acked-by: Michal Hocko --- include/linux/mm.h | 6

[PATCH v19 4/7] virtio-balloon: VIRTIO_BALLOON_F_SG

2017-12-12 Thread Wei Wang
-by: Wei Wang <wei.w.w...@intel.com> Signed-off-by: Liang Li <liang.z...@intel.com> Suggested-by: Michael S. Tsirkin <m...@redhat.com> Cc: Tetsuo Handa <penguin-ker...@i-love.sakura.ne.jp> --- drivers/virtio/virtio_balloon.c | 232

[PATCH v19 4/7] virtio-balloon: VIRTIO_BALLOON_F_SG

2017-12-12 Thread Wei Wang
-by: Wei Wang Signed-off-by: Liang Li Suggested-by: Michael S. Tsirkin Cc: Tetsuo Handa --- drivers/virtio/virtio_balloon.c | 232 +--- include/uapi/linux/virtio_balloon.h | 1 + 2 files changed, 215 insertions(+), 18 deletions(-) diff --git a/drivers

Re: [PATCH v18 10/10] virtio-balloon: don't report free pages when page poisoning is enabled

2017-12-10 Thread Wei Wang
On 12/01/2017 11:49 PM, Michael S. Tsirkin wrote: On Wed, Nov 29, 2017 at 09:55:26PM +0800, Wei Wang wrote: The guest free pages should not be discarded by the live migration thread when page poisoning is enabled with PAGE_POISONING_NO_SANITY=n, because skipping the transfer of such poisoned

Re: [PATCH v18 10/10] virtio-balloon: don't report free pages when page poisoning is enabled

2017-12-10 Thread Wei Wang
On 12/01/2017 11:49 PM, Michael S. Tsirkin wrote: On Wed, Nov 29, 2017 at 09:55:26PM +0800, Wei Wang wrote: The guest free pages should not be discarded by the live migration thread when page poisoning is enabled with PAGE_POISONING_NO_SANITY=n, because skipping the transfer of such poisoned

Re: [PATCH v18 05/10] xbitmap: add more operations

2017-12-07 Thread Wei Wang
On 12/03/2017 09:50 AM, Tetsuo Handa wrote: Matthew Wilcox wrote: On Fri, Dec 01, 2017 at 03:09:08PM +, Wang, Wei W wrote: On Friday, December 1, 2017 9:02 PM, Tetsuo Handa wrote: If start == end is legal, for (; start < end; start = (start | (IDA_BITMAP_BITS - 1)) + 1) { makes this

Re: [PATCH v18 05/10] xbitmap: add more operations

2017-12-07 Thread Wei Wang
On 12/03/2017 09:50 AM, Tetsuo Handa wrote: Matthew Wilcox wrote: On Fri, Dec 01, 2017 at 03:09:08PM +, Wang, Wei W wrote: On Friday, December 1, 2017 9:02 PM, Tetsuo Handa wrote: If start == end is legal, for (; start < end; start = (start | (IDA_BITMAP_BITS - 1)) + 1) { makes this

Re: [PATCH v18 10/10] virtio-balloon: don't report free pages when page poisoning is enabled

2017-12-03 Thread Wei Wang
On 12/01/2017 11:49 PM, Michael S. Tsirkin wrote: On Wed, Nov 29, 2017 at 09:55:26PM +0800, Wei Wang wrote: The guest free pages should not be discarded by the live migration thread when page poisoning is enabled with PAGE_POISONING_NO_SANITY=n, because skipping the transfer of such poisoned

Re: [PATCH v18 10/10] virtio-balloon: don't report free pages when page poisoning is enabled

2017-12-03 Thread Wei Wang
On 12/01/2017 11:49 PM, Michael S. Tsirkin wrote: On Wed, Nov 29, 2017 at 09:55:26PM +0800, Wei Wang wrote: The guest free pages should not be discarded by the live migration thread when page poisoning is enabled with PAGE_POISONING_NO_SANITY=n, because skipping the transfer of such poisoned

Re: [PATCH v18 07/10] virtio-balloon: VIRTIO_BALLOON_F_SG

2017-12-03 Thread Wei Wang
On 12/01/2017 11:38 PM, Michael S. Tsirkin wrote: On Wed, Nov 29, 2017 at 09:55:23PM +0800, Wei Wang wrote: +static void send_one_desc(struct virtio_balloon *vb, + struct virtqueue *vq, + uint64_t addr, + uint32_t len

Re: [PATCH v18 07/10] virtio-balloon: VIRTIO_BALLOON_F_SG

2017-12-03 Thread Wei Wang
On 12/01/2017 11:38 PM, Michael S. Tsirkin wrote: On Wed, Nov 29, 2017 at 09:55:23PM +0800, Wei Wang wrote: +static void send_one_desc(struct virtio_balloon *vb, + struct virtqueue *vq, + uint64_t addr, + uint32_t len

Re: [PATCH v18 06/10] virtio_ring: add a new API, virtqueue_add_one_desc

2017-12-01 Thread Wei Wang
On 12/01/2017 03:38 AM, Michael S. Tsirkin wrote: On Wed, Nov 29, 2017 at 09:55:22PM +0800, Wei Wang wrote: Current virtqueue_add API implementation is based on the scatterlist struct, which uses kaddr. This is inadequate to all the use case of vring. For example: - Some usages don't use IOMMU

Re: [PATCH v18 06/10] virtio_ring: add a new API, virtqueue_add_one_desc

2017-12-01 Thread Wei Wang
On 12/01/2017 03:38 AM, Michael S. Tsirkin wrote: On Wed, Nov 29, 2017 at 09:55:22PM +0800, Wei Wang wrote: Current virtqueue_add API implementation is based on the scatterlist struct, which uses kaddr. This is inadequate to all the use case of vring. For example: - Some usages don't use IOMMU

Re: [PATCH v18 05/10] xbitmap: add more operations

2017-12-01 Thread Wei Wang
On 11/30/2017 06:34 PM, Tetsuo Handa wrote: Wei Wang wrote: + * @start: the start of the bit range, inclusive + * @end: the end of the bit range, inclusive + * + * This function is used to clear a bit in the xbitmap. If all the bits of the + * bitmap are 0, the bitmap will be freed. + */ +void

Re: [PATCH v18 05/10] xbitmap: add more operations

2017-12-01 Thread Wei Wang
On 11/30/2017 06:34 PM, Tetsuo Handa wrote: Wei Wang wrote: + * @start: the start of the bit range, inclusive + * @end: the end of the bit range, inclusive + * + * This function is used to clear a bit in the xbitmap. If all the bits of the + * bitmap are 0, the bitmap will be freed. + */ +void

[PATCH v18 01/10] idr: add #include

2017-11-29 Thread Wei Wang
to solve the issue. Signed-off-by: Wei Wang <wei.w.w...@intel.com> Cc: Matthew Wilcox <mawil...@microsoft.com> Cc: Andrew Morton <a...@linux-foundation.org> Cc: Jan Kara <j...@suse.cz> Cc: Eric Biggers <ebigg...@google.com> Cc: Tejun Heo <t...@kernel.org&g

[PATCH v18 01/10] idr: add #include

2017-11-29 Thread Wei Wang
to solve the issue. Signed-off-by: Wei Wang Cc: Matthew Wilcox Cc: Andrew Morton Cc: Jan Kara Cc: Eric Biggers Cc: Tejun Heo Cc: Masahiro Yamada --- include/linux/idr.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/linux/idr.h b/include/linux/idr.h index 7c3a365..fa14f83 100644

[PATCH v18 00/10] Virtio-balloon Enhancement

2017-11-29 Thread Wei Wang
rmat, instead of two. 2) re-write the virtio-balloon implementation patch. 3) commit changes 4) patch re-org Matthew Wilcox (1): xbitmap: Introduce xbitmap Wei Wang (9): idr: add #include radix tree test suite: remove ARRAY_SIZE to avoid redefinition xbitmap: potential improvement xbitm

[PATCH v18 00/10] Virtio-balloon Enhancement

2017-11-29 Thread Wei Wang
rmat, instead of two. 2) re-write the virtio-balloon implementation patch. 3) commit changes 4) patch re-org Matthew Wilcox (1): xbitmap: Introduce xbitmap Wei Wang (9): idr: add #include radix tree test suite: remove ARRAY_SIZE to avoid redefinition xbitmap: potential improvement xbitm

[PATCH v18 03/10] xbitmap: Introduce xbitmap

2017-11-29 Thread Wei Wang
st_bit(). Signed-off-by: Wei Wang <wei.w.w...@intel.com> --- include/linux/radix-tree.h | 2 + include/linux/xbitmap.h | 52 + lib/Makefile | 2 +- lib/radix-tree.c | 26 - l

[PATCH v18 03/10] xbitmap: Introduce xbitmap

2017-11-29 Thread Wei Wang
From: Matthew Wilcox The eXtensible Bitmap is a sparse bitmap representation which is efficient for set bits which tend to cluster. It supports up to 'unsigned long' worth of bits, and this commit adds the bare bones -- xb_set_bit(), xb_clear_bit() and xb_test_bit(). Signed-off-by: Wei Wang

[PATCH v18 07/10] virtio-balloon: VIRTIO_BALLOON_F_SG

2017-11-29 Thread Wei Wang
. Signed-off-by: Wei Wang <wei.w.w...@intel.com> Signed-off-by: Liang Li <liang.z...@intel.com> Suggested-by: Michael S. Tsirkin <m...@redhat.com> Cc: Tetsuo Handa <penguin-ker...@i-love.sakura.ne.jp> --- drivers/virtio/virtio_balloon.c | 230 ++

[PATCH v18 07/10] virtio-balloon: VIRTIO_BALLOON_F_SG

2017-11-29 Thread Wei Wang
. Signed-off-by: Wei Wang Signed-off-by: Liang Li Suggested-by: Michael S. Tsirkin Cc: Tetsuo Handa --- drivers/virtio/virtio_balloon.c | 230 +--- include/uapi/linux/virtio_balloon.h | 1 + 2 files changed, 212 insertions(+), 19 deletions(-) diff --git

[PATCH v18 06/10] virtio_ring: add a new API, virtqueue_add_one_desc

2017-11-29 Thread Wei Wang
address and len. Also, factor out the common code with virtqueue_add in vring_set_avail. Signed-off-by: Wei Wang <wei.w.w...@intel.com> Cc: Michael S. Tsirkin <m...@redhat.com> --- drivers/virtio/virtio_ring.c | 94 +++- include/linux/virtio.h

[PATCH v18 06/10] virtio_ring: add a new API, virtqueue_add_one_desc

2017-11-29 Thread Wei Wang
address and len. Also, factor out the common code with virtqueue_add in vring_set_avail. Signed-off-by: Wei Wang Cc: Michael S. Tsirkin --- drivers/virtio/virtio_ring.c | 94 +++- include/linux/virtio.h | 6 +++ 2 files changed, 81 insertions(+), 19

Re: [PATCH v17 2/6] radix tree test suite: add tests for xbitmap

2017-11-29 Thread Wei Wang
On 11/07/2017 01:00 AM, Matthew Wilcox wrote: On Fri, Nov 03, 2017 at 04:13:02PM +0800, Wei Wang wrote: From: Matthew Wilcox <mawil...@microsoft.com> Add the following tests for xbitmap: 1) single bit test: single bit set/clear/find; 2) bit range test: set/clear a range of bits and fi

Re: [PATCH v17 2/6] radix tree test suite: add tests for xbitmap

2017-11-29 Thread Wei Wang
On 11/07/2017 01:00 AM, Matthew Wilcox wrote: On Fri, Nov 03, 2017 at 04:13:02PM +0800, Wei Wang wrote: From: Matthew Wilcox Add the following tests for xbitmap: 1) single bit test: single bit set/clear/find; 2) bit range test: set/clear a range of bits and find a 0 or 1 bit in the range

<    1   2   3   4   5   6   7   8   9   10   >