From: Andre Przywara <andre.przywara@amd.com>
To: Corentin Chary <corentin.chary@gmail.com>
Cc: Anthony Liguori <aliguori@linux.vnet.ibm.com>,
Qemu-development List <qemu-devel@nongnu.org>,
Alexander Graf <agraf@suse.de>
Subject: Re: [Qemu-devel] New Bitmap module ?
Date: Thu, 22 Jul 2010 15:46:38 +0200 [thread overview]
Message-ID: <4C484BBE.40908@amd.com> (raw)
In-Reply-To: <AANLkTimQuDH45FL5ptQFpNNF02mMOWTc8PoQsECK2Ynm@mail.gmail.com>
[-- 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
next prev parent reply other threads:[~2010-07-22 13:52 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-21 5:49 [Qemu-devel] New Bitmap module ? Corentin Chary
2010-07-22 13:46 ` Andre Przywara [this message]
2010-07-23 7:27 ` Corentin Chary
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4C484BBE.40908@amd.com \
--to=andre.przywara@amd.com \
--cc=agraf@suse.de \
--cc=aliguori@linux.vnet.ibm.com \
--cc=corentin.chary@gmail.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).