Skip to contentSkip to conversation

get_mempolicy(2) type mismatch

DISCUSSION Jörn Engel 4 participants 4 messages May 3, 2016 – Jun 3, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

The manpage seems to have the wrong type for "addr".

Manpage:
int get_mempolicy(int *mode, unsigned long *nodemask,
unsigned long maxnode, unsigned long addr, unsigned long flags);

/usr/include/numaif.h:
extern long get_mempolicy(int *policy, const unsigned long *nmask,

                        unsigned long maxnode, void *addr, int flags);

J�rn

--
The more any quantitative social indicator is used for social decision-making, the more subject it will be to corruption pressures and the more apt it will be to distort and corrupt the social processes it is intended to monitor. -- Campbell's law

#1 lore raw

[ Removed linux-fsdevel - shouldn't have been on Cc: ]

Quoted 10 lines · Jörn Engel

The manpage seems to have the wrong type for "addr".

Manpage:
int get_mempolicy(int *mode, unsigned long *nodemask,
unsigned long maxnode, unsigned long addr, unsigned long flags);

/usr/include/numaif.h:
extern long get_mempolicy(int *policy, const unsigned long *nmask,

                        unsigned long maxnode, void *addr, int flags);

Found another problem.

"is always rounded to a multiple of sizeof(unsigned long)"

I suspect the rounding should be done to a multiple of BITS_PER_LONG, or "sizeof(unsigned long) * 8".

Jörn, wondering how many others actually care about NUMA

--
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
-- Brian W. Kernighan
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#2 lore raw

Hi Jörn,

Quoted 14 lines · Jörn Engel

[ Removed linux-fsdevel - shouldn't have been on Cc: ]

Quoted 10 lines · Jörn Engel

The manpage seems to have the wrong type for "addr".

Manpage:
int get_mempolicy(int *mode, unsigned long *nodemask,
unsigned long maxnode, unsigned long addr, unsigned long flags);

/usr/include/numaif.h:
extern long get_mempolicy(int *policy, const unsigned long *nmask,

                        unsigned long maxnode, void *addr, int flags);
Quoted 6 lines

Found another problem.

"is always rounded to a multiple of sizeof(unsigned long)"

I suspect the rounding should be done to a multiple of BITS_PER_LONG, or "sizeof(unsigned long) * 8".

It looks to me like you are right, but with reports like this, it's really helpful if you provide me some context on why you drew the conclusion. That makes things much easier to check.

For example, you could cite pieces of code such as the following in mm/mempolicy.c::COMPAT_SYSCALL_DEFINE5(get_mempolicy):

        nr_bits = min_t(unsigned long, maxnode-1, MAX_NUMNODES);
        alloc_size = ALIGN(nr_bits, BITS_PER_LONG) / 8;
Quoted 1 line

Jörn, wondering how many others actually care about NUMA

Intersection of the set of people who care about both NUMA and docs is evidently small... Thanks for taking care.

Cheers,

Michael

Signature · 7 lines
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#3 lore raw
In reply to Jörn Engel
Quoted 7 lines · Jörn Engel

The manpage seems to have the wrong type for "addr".

Manpage:
int get_mempolicy(int *mode, unsigned long *nodemask,
unsigned long maxnode, unsigned long addr, unsigned long flags);

Quoted 5 lines

/usr/include/numaif.h:
extern long get_mempolicy(int *policy, const unsigned long *nmask,

                        unsigned long maxnode, void *addr, int flags);

Jörn

Hmmm -- it seems that the numactl package headers differ from the kernel headers (where the man page is accurate). But, it seems like the man page should reflect what's in the user-space header file, so I fixed it to be

void *addr

Cheers,

Michael

Signature · 7 lines
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html