Open MPI logo

Hardware Locality Users' Mailing List Archives

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

Subject: Re: [hwloc-users] possible concurrency issue with reading /proc data on Linux
From: Brice Goglin (Brice.Goglin_at_[hidden])
Date: 2012-04-21 17:44:50


On 21/04/2012 23:36, Vlad wrote:
>
> Will try this within a day or two. At the moment I am simply using a
> retry loop on ENOSYS and usually no more than one retry is needed.

Ok thanks.

> You are probably correct. I was thinking of this code from
> https://svn.open-mpi.org/trac/hwloc/browser/trunk/src/topology-linux.c:
>
> 445 while ((dirent = readdir(taskdir)) != NULL) {
>
> "taskdir" here is /proc/<pid>/task, correct? In which case the threads
> will be doing readdir() on the same DIR stream...

taskdir is a different DIR* for each thread here: each thread does its
own get_last_cpu_location() which calls its own instance of opendir().
Even if the directory behind these DIR* descriptors are the same, it
should be fine, there's no concurrency on the same DIR* descriptor in
readdir.

Brice

>
>
>
>
>>
>> Thanks
>> Brice
>>
>> <fix_tids.patch>_______________________________________________
>> hwloc-users mailing list
>> hwloc-users_at_[hidden] <mailto:hwloc-users_at_[hidden]>
>> http://www.open-mpi.org/mailman/listinfo.cgi/hwloc-users
> If the patch doesn't help, can you send your code to help debug things?
>
>
>
> _______________________________________________
> hwloc-users mailing list
> hwloc-users_at_[hidden]
> http://www.open-mpi.org/mailman/listinfo.cgi/hwloc-users