From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753202AbbLJViv (ORCPT ); Thu, 10 Dec 2015 16:38:51 -0500 Received: from smtp-out-no.shaw.ca ([64.59.134.12]:42661 "EHLO smtp-out-no.shaw.ca" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750834AbbLJViu (ORCPT ); Thu, 10 Dec 2015 16:38:50 -0500 X-Greylist: delayed 488 seconds by postgrey-1.27 at vger.kernel.org; Thu, 10 Dec 2015 16:38:50 EST X-Authority-Analysis: v=2.1 cv=N9CJbzJB c=1 sm=1 tr=0 a=b4X6fhI4x5MOnsgcuOa5CA==:117 a=b4X6fhI4x5MOnsgcuOa5CA==:17 a=IkcTkHD0fZMA:10 a=M_vCFVlJV8VYtwz2p8kA:9 a=QEXdDO2ut3YA:10 Message-ID: <5669EEFF.20801@mail.usask.ca> Date: Thu, 10 Dec 2015 15:30:39 -0600 From: Chris Friesen User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 MIME-Version: 1.0 To: "linux-kernel@vger.kernel.org >> lkml" Subject: question about cpusets vs sched_setaffinity() Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-CMAE-Envelope: MS4wfE1o7u6PsMaSN6XFN6UDCC3VjhqBL436MDIOcH5/tlErTXsTPPM5jbFHT2R3tGf7IhtUFhCEiQW+OEDNPtcDufYIcNJU5t+rDWmJI36t37iEc+sttP8y zNPWhbYnra32TuV6EfefSsUbj1tya5R64yldoaKe9begdtA2lkJ/b75nF0+8yBkicqeORiaQUh7doQ== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, I've got a question about the interaction between cpusets and sched_setaffinity(). If I put a task into a cpuset and then call sched_setaffinity() on it, it will be affined to the intersection of the two sets of cpus. (Those specified on the set, and those specified in the syscall.) However, if I then change the cpus in the cpuset the process affinity will simply be overwritten by the new cpuset affinity. It does not seem to take into account any restrictions from the original sched_setaffinity() call. Wouldn't it make more sense to affine the process to the intersection between the new set of cpus from the cpuset, and the current process affinity? That way if I explicitly masked out certain CPUs in the original sched_setaffinity() call then they would remain masked out regardless of changes to the set of cpus assigned to the cpuset. Thanks, Chris PS: Not subscribed to the list, please CC me on replies.