You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, we found a bug in sched_pin() on 64bits linux platform when ncpus > 32.
The code is like this:
int word = i / (8 * sizeof(unsigned long));
int bit = i % (8 * sizeof(unsigned long));
mask[word] |= (1 << bit);
On 64bits platform, bit can be [0, 63], but (1 << bit) has only 32 bits.
So if we want to bind this task to cpu33, (1 << 33) == (1 << 1), then this task will be bind to cpu1.
If I modify the code like this, I can get correct results.
mask[word] |= ((unsigned long)1 << bit);
Because ((unsigned long)1 << bit) has 64 bits.
Thanks.
The text was updated successfully, but these errors were encountered:
Hi, we found a bug in sched_pin() on 64bits linux platform when ncpus > 32.
The code is like this:
int word = i / (8 * sizeof(unsigned long));
int bit = i % (8 * sizeof(unsigned long));
mask[word] |= (1 << bit);
On 64bits platform, bit can be [0, 63], but (1 << bit) has only 32 bits.
So if we want to bind this task to cpu33, (1 << 33) == (1 << 1), then this task will be bind to cpu1.
If I modify the code like this, I can get correct results.
mask[word] |= ((unsigned long)1 << bit);
Because ((unsigned long)1 << bit) has 64 bits.
Thanks.
The text was updated successfully, but these errors were encountered: