Return-Path: <pj@sgi.com>
Received: from localhost (bix [127.0.0.1])
	by localhost.localdomain (8.12.10/8.12.10) with ESMTP id i8B8UMGh021194
	for <akpm@localhost>; Sat, 11 Sep 2004 01:30:23 -0700
Received: from bix [127.0.0.1]
	by localhost with POP3 (fetchmail-6.2.0)
	for akpm@localhost (single-drop); Sat, 11 Sep 2004 01:30:23 -0700 (PDT)
Received: from fire-1.osdl.org (fire.osdl.org [65.172.181.4])
	by mail.osdl.org (8.11.6/8.11.6) with ESMTP id i8B8T0v11780
	for <akpm@mail.gateway.osdl.net>; Sat, 11 Sep 2004 01:29:00 -0700
Received: from omx2.sgi.com (omx2-ext.sgi.com [192.48.171.19])
	by fire-1.osdl.org (8.12.8/8.12.8) with ESMTP id i8B8SxSe021344
	for <akpm@osdl.org>; Sat, 11 Sep 2004 01:28:59 -0700
Received: from cthulhu.engr.sgi.com (cthulhu.engr.sgi.com [192.26.80.2])
	by omx2.sgi.com (8.12.11/8.12.9/linux-outbound_gateway-1.1) with ESMTP id i8B9a4Qr021043;
	Sat, 11 Sep 2004 02:36:04 -0700
Received: from sam.engr.sgi.com (sam.engr.sgi.com [163.154.6.103])
	by cthulhu.engr.sgi.com (SGI-8.12.5/8.12.5) with ESMTP id i8B8SQY99662581;
	Sat, 11 Sep 2004 01:28:26 -0700 (PDT)
Date: Sat, 11 Sep 2004 01:28:26 -0700 (PDT)
From: Paul Jackson <pj@sgi.com>
To: Andrew Morton <akpm@osdl.org>
Cc: Paul Jackson <pj@sgi.com>, Simon Derr <Simon.Derr@bull.net>,
        linux-kernel@vger.kernel.org
Message-Id: <20040911082828.10372.39917.52342@sam.engr.sgi.com>
In-Reply-To: <20040911082810.10372.86008.84920@sam.engr.sgi.com>
References: <20040911082810.10372.86008.84920@sam.engr.sgi.com>
Subject: [Patch 3/4] cpusets remove useless validation check
X-MIMEDefang-Filter: osdl$Revision: 1.73 $
X-Scanned-By: MIMEDefang 2.36
X-Spam-Status: No, hits=-4.9 required=1.0 tests=BAYES_00 autolearn=ham 
	version=2.60
X-Spam-Checker-Version: SpamAssassin 2.60 (1.212-2003-09-23-exp) on bix
X-Spam-Level: 

As reported to me by Simon Derr, there was an off by one
error in checking the usage count in validate_change().
However, after realizing that there was no way to exploit
this error, I determined that the check (for an empty
cpuset) could never fail here.  This is because:
 1) other code ensures we only attach a task to non-empty
    cpusets, and
 2) there is no way to make a non-empty cpuset empty again.

So, rather than fix the useless check, just remove it.

Signed-off-by: Paul Jackson <pj@sgi.com>

Index: 2.6.9-rc1-mm4/kernel/cpuset.c
===================================================================
--- 2.6.9-rc1-mm4.orig/kernel/cpuset.c	2004-09-08 18:44:33.000000000 -0700
+++ 2.6.9-rc1-mm4/kernel/cpuset.c	2004-09-08 18:45:40.000000000 -0700
@@ -501,14 +501,6 @@ static int validate_change(const struct 
 	if (cur == &top_cpuset)
 		return -EPERM;
 
-	/* Any in-use cpuset must have at least ONE cpu and mem */
-	if (atomic_read(&trial->count) > 1) {
-		if (cpus_empty(trial->cpus_allowed))
-			return -ENOSPC;
-		if (nodes_empty(trial->mems_allowed))
-			return -ENOSPC;
-	}
-
 	/* We must be a subset of our parent cpuset */
 	if (!is_cpuset_subset(trial, par))
 		return -EACCES;

-- 
                          I won't rest till it's the best ...
                          Programmer, Linux Scalability
                          Paul Jackson <pj@sgi.com> 1.650.933.1373