mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
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
Subject: [Patch 3/4] cpusets remove useless validation check
Date: Sat, 11 Sep 2004 01:28:26 -0700 (PDT)	[thread overview]
Message-ID: <20040911082828.10372.39917.52342@sam.engr.sgi.com> (raw)
In-Reply-To: <20040911082810.10372.86008.84920@sam.engr.sgi.com>

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

  parent reply	other threads:[~2004-09-11  8:30 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-11  8:28 [Patch 0/4] four small cpuset patches Paul Jackson
2004-09-11  8:28 ` [Patch 1/4] cpusets display allowed masks in proc status Paul Jackson
2004-09-11  8:28 ` [Patch 2/4] cpusets simplify cpus_allowed setting in attach Paul Jackson
2004-09-11  8:28 ` Paul Jackson [this message]
2004-09-11  8:28 ` [Patch 4/4] cpusets top mask just online, not all possible Paul Jackson
2004-09-11 14:10   ` Anton Blanchard
2004-09-11 17:07     ` Paul Jackson
2004-09-11 17:28       ` Dave Hansen
2004-09-12  2:21         ` Paul Jackson
2004-09-12  4:43           ` Dave Hansen
2004-09-12  5:35             ` Paul Jackson
2004-09-12  5:42             ` Paul Jackson
2004-09-11 17:39       ` Dave Hansen
2004-09-11 18:55       ` Andi Kleen
2004-09-12  2:29         ` Paul Jackson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040911082828.10372.39917.52342@sam.engr.sgi.com \
    --to=pj@sgi.com \
    --cc=Simon.Derr@bull.net \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®