[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.11.1505182354430.4225@nanos>
Date: Mon, 18 May 2015 23:55:24 +0200 (CEST)
From: Thomas Gleixner <tglx@...utronix.de>
To: Dave Hansen <dave@...1.net>
cc: linux-kernel@...r.kernel.org, x86@...nel.org,
dave.hansen@...ux.intel.com
Subject: Re: [PATCH 17/19] x86, mpx: rewrite unmap code
On Fri, 8 May 2015, Dave Hansen wrote:
> The MPX code needs to clear out bounds tables for memory which
> is no longer in use. We do this when a userspace mapping is
> torn down (unmapped).
>
> There are two modes:
> 1. An entire bounds table becomes unused, and can be freed
> and its pointer removed from the bounds directory. This
> happens either when a large mapping is torn down, or when
> a small mapping is torn down and it is the last mapping
> "covered" by a bounds table.
> 2. Only part of a bounds table becomes unused, in which case
> we free the backing memory as if MADV_DONTNEED was called.
>
> The old code was a spaghetti mess of "edge" bounds tables
> where the edges were handled specially, even if we were
> unmapping an entire one. Non-edge bounds tables are always
> fully unmapped, but share a different code path from the edge
> ones. The old code had a bug where it was unmapping too much
> memory. I worked on fixing it for two days and gave up.
>
> I didn't write the original code. I didn't particularly like
> it, but it worked, so I left it. After my debug session, I
> realized it was undebuggagle *and* buggy, so out it went.
>
> I also wrote a new unmapping test program which uncovers bugs
> pretty nicely.
Very appreciated. This is really readable now.
Reviewed-by: Thomas Gleixner <tglx@...utronix.de>
--
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