Date: Wed, 5 Jun 2013 11:13:33 -0400 From: John Baldwin <jhb@freebsd.org> To: freebsd-arch@freebsd.org Subject: Re: [PATCH] Allow atomic sets of non-overlapping CPU sets for a global cpuset Message-ID: <201306051113.33907.jhb@freebsd.org> In-Reply-To: <201305311216.56558.jhb@freebsd.org> References: <201305311216.56558.jhb@freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Friday, May 31, 2013 12:16:56 pm John Baldwin wrote: > So there's an oddity with cpuset I've run into recently at work. Suppose I > have created a new cpuset and want to change the set of CPUs for that set (say > from a mask of just CPU 1 to a mask of just CPU 2). I can't do that > atomically. I have to first set the mask to contain both the old set (CPU 1) > and the new set (CPU 2) and then change it a second time to only contain the > new set (CPU 2). The reason is that cpuset_modify() runs cpuset_testupdate() > on the set it is about to modify, so when I try to change it in a single > operation the new mask doesn't overlap with the old mask and it fails with > EDEADLK. > > % cpuset -c -l 1 /bin/sh > $ cpuset -gi > pid -1 cpuset id: 2 > $ cpuset -g > pid -1 mask: 1 > $ cpuset -l 2 -s 2 > cpuset: setaffinity: Resource deadlock avoided Also note that non-overlapping masks work fine if you change the "local" mask of a process: % cpuset -l 1 /bin/sh $ cpuset -g pid -1 mask: 1 $ cpuset -l 2 -p $$ $ cpuset -g pid -1 mask: 2 -- John Baldwin
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201306051113.33907.jhb>