From owner-svn-src-stable@FreeBSD.ORG Mon Jun 24 18:37:52 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id C09C4298; Mon, 24 Jun 2013 18:37:52 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 985BA1844; Mon, 24 Jun 2013 18:37:52 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5OIbqx5091982; Mon, 24 Jun 2013 18:37:52 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5OIbqoo091981; Mon, 24 Jun 2013 18:37:52 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201306241837.r5OIbqoo091981@svn.freebsd.org> From: John Baldwin Date: Mon, 24 Jun 2013 18:37:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r252167 - stable/8/sys/kern X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jun 2013 18:37:52 -0000 Author: jhb Date: Mon Jun 24 18:37:52 2013 New Revision: 252167 URL: http://svnweb.freebsd.org/changeset/base/252167 Log: MFC 251470: Do not compare the existing mask of a cpuset with a new mask when changing the mask of a cpuset. Also, change the cpuset's mask before updating the masks of all children. Previously changing a cpuset's mask first required setting the mask to a super-set of both the old and new masks and then changing it a second time to the new mask. Modified: stable/8/sys/kern/kern_cpuset.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/kern/ (props changed) Modified: stable/8/sys/kern/kern_cpuset.c ============================================================================== --- stable/8/sys/kern/kern_cpuset.c Mon Jun 24 18:30:44 2013 (r252166) +++ stable/8/sys/kern/kern_cpuset.c Mon Jun 24 18:37:52 2013 (r252167) @@ -298,7 +298,7 @@ cpuset_create(struct cpuset **setp, stru * empty as well as RDONLY flags. */ static int -cpuset_testupdate(struct cpuset *set, cpuset_t *mask) +cpuset_testupdate(struct cpuset *set, cpuset_t *mask, int check_mask) { struct cpuset *nset; cpuset_t newmask; @@ -307,13 +307,16 @@ cpuset_testupdate(struct cpuset *set, cp mtx_assert(&cpuset_lock, MA_OWNED); if (set->cs_flags & CPU_SET_RDONLY) return (EPERM); - if (!CPU_OVERLAP(&set->cs_mask, mask)) - return (EDEADLK); - CPU_COPY(&set->cs_mask, &newmask); - CPU_AND(&newmask, mask); + if (check_mask) { + if (!CPU_OVERLAP(&set->cs_mask, mask)) + return (EDEADLK); + CPU_COPY(&set->cs_mask, &newmask); + CPU_AND(&newmask, mask); + } else + CPU_COPY(mask, &newmask); error = 0; LIST_FOREACH(nset, &set->cs_children, cs_siblings) - if ((error = cpuset_testupdate(nset, &newmask)) != 0) + if ((error = cpuset_testupdate(nset, &newmask, 1)) != 0) break; return (error); } @@ -365,11 +368,11 @@ cpuset_modify(struct cpuset *set, cpuset if (root && !CPU_SUBSET(&root->cs_mask, mask)) return (EINVAL); mtx_lock_spin(&cpuset_lock); - error = cpuset_testupdate(set, mask); + error = cpuset_testupdate(set, mask, 0); if (error) goto out; - cpuset_update(set, mask); CPU_COPY(mask, &set->cs_mask); + cpuset_update(set, mask); out: mtx_unlock_spin(&cpuset_lock);