Re: [PATCH 1/5] freepgt: free_pgtables use vma list

David S. Miller
2005-03-23T02:10:59Z

On Wed, 23 Mar 2005 00:51:02 +0000 (GMT)
Hugh Dickins <hugh@veritas.com> wrote:

> This actual example helped to focus my mind a lot, thank you.

No problem, I needed to work through specific examples
to see things clearly too.

> > and things seem to behave. I'll try to analyze things
> > further and test this out on a real kernel, but all of
> > these adjustments at the top of free_pgd_range() really
> > start to look like pure spaghetti. :-)
>
> Well, it's trying to decide in reasonably few steps that it's not
> worth wasting time going down to the deeper levels. Lots of
> "return"s as it eliminates cases, yes.

Yes, I understand.

But let's recognize (as I mention in another email) that all of
the tests against ceiling are against "ceiling - 1". If we pass
-1 instead of 0 (and "foo - 1" instead of "foo") as the ceiling
arg, then adjust the tests to be against plain "ceiling", so much
of the special casing disappears.

There are probably other simplifications.

This is kind of what I was hinting at when I said it looks like
spaghetti. :-)