* [Qemu-devel] New Bitmap module ? @ 2010-07-21 5:49 Corentin Chary 2010-07-22 13:46 ` Andre Przywara 0 siblings, 1 reply; 3+ messages in thread From: Corentin Chary @ 2010-07-21 5:49 UTC (permalink / raw) To: Qemu-development List, Anthony Liguori; +Cc: Alexander Graf Hi, I was working on merging VNC updates into bigger ones to see if it lower the overhead (big updates sometime use less network/cpu than a lot of small updates). For that, I needed some new bitmap functions, and no we got, in vnc.c: - set_bit - clear_bit - set_bits - clear_bits - find_next_bit - find_next_zero_bit - find_next_zero_area Should we move that into bitmap.c/bitmap.h ? Which part of QEMU could use that (block.c maybe ?) Thanks -- Corentin Chary http://xf.iksaif.net ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] New Bitmap module ? 2010-07-21 5:49 [Qemu-devel] New Bitmap module ? Corentin Chary @ 2010-07-22 13:46 ` Andre Przywara 2010-07-23 7:27 ` Corentin Chary 0 siblings, 1 reply; 3+ messages in thread From: Andre Przywara @ 2010-07-22 13:46 UTC (permalink / raw) To: Corentin Chary; +Cc: Anthony Liguori, Qemu-development List, Alexander Graf [-- Attachment #1: Type: text/plain, Size: 1115 bytes --] Corentin Chary wrote: > Hi, > I was working on merging VNC updates into bigger ones to see if it > lower the overhead (big updates sometime use less network/cpu than a > lot of small updates). > For that, I needed some new bitmap functions, and no we got, in vnc.c: > - set_bit > - clear_bit > - set_bits > - clear_bits > - find_next_bit > - find_next_zero_bit > - find_next_zero_area > > Should we move that into bitmap.c/bitmap.h ? Definitely! For my NUMA work I have also coded some bitmap functions. Since mine are not performance critical, I reverted from implementing set_bits and clear_bits and replaced them with a loop in the calling code. So I could just could come around with a macro only implementation, for which a header file suffices (attached for reference). > Which part of QEMU could > use that (block.c maybe ?) As mentioned, the yet to be submitted NUMA code would benefit from it. Linux has also bitmap code, maybe you could leverage this (if not already done). Regards, Andre. -- Andre Przywara AMD-Operating System Research Center (OSRC), Dresden, Germany Tel: +49 351 448-3567-12 [-- Attachment #2: bitmap.h --] [-- Type: text/plain, Size: 661 bytes --] #ifndef __BITMAP_H__ #define __BITMAP_H__ #ifndef HOST_LONG_BITS #define HOST_LONG_BITS (sizeof(long) * 8) #endif #define bitmap_isset(bm,bit) \ (!!bm[(bit) / HOST_LONG_BITS] & (1ULL << ((bit) % HOST_LONG_BITS))) #define bitmap_set(bm,bit) \ (bm[(bit) / HOST_LONG_BITS] |= (1ULL << ((bit) % HOST_LONG_BITS))) #define bitmap_unset(bm,bit) \ (bm[(bit) / HOST_LONG_BITS] &= ~(1ULL << ((bit) % HOST_LONG_BITS))) #define DECLARE_BITMAP(bm,len) \ unsigned long bm[((len) + HOST_LONG_BITS - 1) / HOST_LONG_BITS] #define bitmap_clear(bm,len) \ memset(bm, 0, (len + 7) / 8) #define bitmap_fill(bm,len) \ memset(bm, 0xFF, (len + 7) / 8) #endif ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] New Bitmap module ? 2010-07-22 13:46 ` Andre Przywara @ 2010-07-23 7:27 ` Corentin Chary 0 siblings, 0 replies; 3+ messages in thread From: Corentin Chary @ 2010-07-23 7:27 UTC (permalink / raw) To: Andre Przywara; +Cc: Anthony Liguori, Qemu-development List, Alexander Graf On Thu, Jul 22, 2010 at 3:46 PM, Andre Przywara <andre.przywara@amd.com> wrote: > Corentin Chary wrote: >> >> Hi, >> I was working on merging VNC updates into bigger ones to see if it >> lower the overhead (big updates sometime use less network/cpu than a >> lot of small updates). >> For that, I needed some new bitmap functions, and no we got, in vnc.c: >> - set_bit >> - clear_bit >> - set_bits >> - clear_bits >> - find_next_bit >> - find_next_zero_bit >> - find_next_zero_area >> >> Should we move that into bitmap.c/bitmap.h ? > > Definitely! For my NUMA work I have also coded some bitmap functions. > Since mine are not performance critical, I reverted from implementing > set_bits and clear_bits and replaced them with a loop in the calling code. > So I could just could come around with a macro only implementation, for > which a header file suffices (attached for reference). > >> Which part of QEMU could >> use that (block.c maybe ?) > > As mentioned, the yet to be submitted NUMA code would benefit from it. Linux > has also bitmap code, maybe you could leverage this (if not already done). Most of my code already comes from Linux. Then I'll try to create that module and send a patch next week. Thanks, -- Corentin Chary http://xf.iksaif.net ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-07-23 7:27 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2010-07-21 5:49 [Qemu-devel] New Bitmap module ? Corentin Chary 2010-07-22 13:46 ` Andre Przywara 2010-07-23 7:27 ` Corentin Chary
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.