Skip to content

use mask operations instead of test_bit()

Juergen Gross xen-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest5 patches 17 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5xen: use masking operation instead of test_bit for RTDS bitsxen/common/sched_rt.c+2 -22 replies
2/5xen: use masking operation instead of test_bit for CSFLAG bitsxen/common/sched_credit2.c+8 -82 replies
3/5xen: use masking operation instead of test_bit for VGCF bitsxen/arch/x86/domain.c+2 -20 replies
4/5xen: use masking operation instead of test_bit for VPF bitsxen/arch/x86/domctl.c xen/arch/x86/hvm/hvm.c xen/arch/x86/hvm/vpt.c +3 more+18 -188 replies
5/5xen: use masking operation instead of test_bit for MCSF bitsxen/arch/x86/domain.c xen/arch/x86/x86_64/compat/mm.c xen/common/multicall.c+7 -70 replies

Reviews trailers per patch

3 of 5 patches have a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchJan BeulichAndrew CooperDario FaggioliGeorge Dunlap
SeriesR-b R-b
1/5A-b A-b
2/5R-b A-b
3/5
4/5R-b
5/5

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 4 reviewers.

Read the v1 thread

Cover letter [PATCH 0/5] use mask operations instead of test_bit()

Instead of using test_bit() which is an atomic operation and limits the compiler's choices to do optimization, use logical ANDs with bitmasks where possible.

The possible candidates have been detected by searching definitions of bitmasks in the form:

#define MASK 1 << _MASK

On x86 the resulting code is slightly smaller (about 2 bytes for each case, checked via disassembly in few examples).

I'm quite sure I didn't replace a test_bit() call required to be atomic, but I'd be grateful for a thorough review especially in the scheduler.

Juergen Gross (5):
xen: use masking operation instead of test_bit for RTDS bits
xen: use masking operation instead of test_bit for CSFLAG bits
xen: use masking operation instead of test_bit for VGCF bits
xen: use masking operation instead of test_bit for VPF bits
xen: use masking operation instead of test_bit for MCSF bits

 xen/arch/x86/domain.c           | 12 ++++++------
 xen/arch/x86/domctl.c           |  2 +-
 xen/arch/x86/hvm/hvm.c          |  4 ++--
 xen/arch/x86/hvm/vpt.c          |  2 +-
 xen/arch/x86/x86_64/compat/mm.c |  4 ++--
 xen/common/domain.c             |  4 ++--
 xen/common/domctl.c             |  8 ++++----
 xen/common/multicall.c          |  2 +-
 xen/common/sched_credit2.c      | 16 ++++++++--------
 xen/common/sched_rt.c           |  4 ++--
 xen/common/schedule.c           | 16 ++++++++--------
 11 files changed, 37 insertions(+), 37 deletions(-)
Signature · 1 line
2.1.4