Page MenuHomeFreeBSD

smp: Use bitwise operation to count cpu number
AcceptedPublic

Authored by aokblast on Sat, Jan 3, 4:37 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Jan 10, 8:34 PM
Unknown Object (File)
Sat, Jan 10, 5:09 AM
Unknown Object (File)
Fri, Jan 9, 4:05 PM
Unknown Object (File)
Wed, Jan 7, 7:43 AM
Unknown Object (File)
Tue, Jan 6, 5:10 PM
Unknown Object (File)
Tue, Jan 6, 7:23 AM
Unknown Object (File)
Sat, Jan 3, 8:37 PM
Subscribers

Details

Reviewers
markj
Summary

Previously, we iterated over all CPUs using CPU_FOREACH and checked
individual bits to count valid CPUs. Refactor this to use a bitwise AND
and popcount to count the number of enabled bits directly.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 69589
Build 66472: arc lint + arc unit

Event Timeline

This revision is now accepted and ready to land.Sat, Jan 3, 4:40 PM

Thanks! Thought I sucessfully booted up on a AMD64 machine, this patch touches the basic logic of smp so I will think twice before landing it.

Thanks! Thought I sucessfully booted up on a AMD64 machine, this patch touches the basic logic of smp so I will think twice before landing it.

It's probably ok, but yes it's a good idea to keep patches in a local tree that you test often. Then you can build some confidence in the changes before landing them.