On Thu, 1 Dec 2016, Marcelo Tosatti wrote: > > There is a locking problem between different applications > reading/writing to resctrlfs directory at the same time (read the patch > below for details). > > Suggest a standard locking scheme for applications to use.
.... > +To coordinate atomic operations on resctrl and avoid the problem > +above, the following locking procedure is recommended: > + > +A) open /var/lock/resctrl/fs.lock with O_CREAT|O_EXCL. > +B) if success, write pid of program accessing the directory > + structure to this file. > +C) read/write the directory structure. > +D) remove file. What's wrong with using flock, which works from shell scripts as well? Thanks, tglx