Open MPI logo

Hardware Locality Development Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Hardware Locality Development mailing list

Subject: [hwloc-devel] very sched_setaffinity support
From: Brice Goglin (Brice.Goglin_at_[hidden])
Date: 2011-12-14 05:21:13

We've been debugging some problems on Redhat 8 with Paul Hargrove and
here's one problems that remains.

  CC topology-linux.lo
../../src/topology-linux.c:71: conflicting types for `sched_setaffinity'
/usr/include/sched.h:69: previous declaration of `sched_setaffinity'
../../src/topology-linux.c:104: conflicting types for `sched_getaffinity'
/usr/include/sched.h:73: previous declaration of `sched_getaffinity'
make[1]: *** [topology-linux.lo] Error 1

His sched.h defines the very old prototype of sched_setaffinity (pid,
len, ulong*). Our current code seems to assume that this prototype won't
ever appear in sched.h:
* if cpu_set and cpu_set_s do not exist in sched.h, the system uses this
ulong* based prototype, that's OK
* then, if syscall3 exist we do define the function using syscall3, but
it conflicts with the one in sched.h because we use const void* instead
of ulong*. That's not OK because we shouldn't do syscall3 if the
prototype is in the header.

If we want to solve the conflict, we would have to know if the type of
the mask in the 3rd argument of the very old sched_setaffinity prototype
changed over time ? We have const void*, redhat 8 has ulong*

Instead, I am thinking of doing:
* change configure to also define a HWLOC_HAVE_SCHED_SETAFFINITY when
there's a sched_setaffinity in sched.h (recent, old or very old)
* change src/topology-linux.c to check HWLOC_HAVE_SCHED_SETAFFINITY
before using syscall3
* document that HWLOC_HAVE_OLD_SCHED_SETAFFINITY is for old, not for
"very old" :)

This is tricky so inputs are welcome.