[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20070322220713.10072423.pj@sgi.com>
Date: Thu, 22 Mar 2007 22:07:13 -0700
From: Paul Jackson <pj@....com>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: cpw@....com, dino@...ibm.com, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/1] cpusets/sched_domain reconciliation
Andrew wrote:
> It isn't very nice. It probably won't crash, but it _can_ crash and when
I guess I got lucky, Cliff, when I snuck in the recursion in the
other cpuset.c routines that you were using as an example here ;).
Since the current kernel/cpuset.c recursion seems only to be in code
paths for cpu hot unplug, it's not surprising that no one has actually
hit it enough times so far to motivate them to hunt me down and
exterminate me. The intersection of the worlds heavy cpuset users
with the worlds heavy cpu unpluggers is a very small set indeed.
Maybe we should do something about this before that set of people grows
to include someone with violent tendencies.
I suppose it would work to set a hard coded limit to how deep one
could make the cpuset hierarchy, and perhaps provide a kernel tunable
for those rare cases where someone needed more than this limit.
We could avoid the recursion here, by converting it to its iterative
equivalent. This equivlaent would have to keep track in a dynamically
allocator vector the cpuset pointers being worked, and if it got to the
end of that vector, reallocate a longer one.
It's not that much more code - and it's a fairly simple transformation
of a simple recursion on one variable to an iteration using a vector
of that variable.
Since the iterative code, using a dynamically sized vector, probably
doesn't add much more kernel text than the code to limit the depth and
provide for a kernel tunable to tweak the limit, and since the iterative
approach avoids imposing some arbitrary small limit on the user visible
API for what is really a small corner case, the iterative approach seems
like the better idea.
--
I won't rest till it's the best ...
Programmer, Linux Scalability
Paul Jackson <pj@....com> 1.925.600.0401
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists