Re: [PATCH 3/3] balancenuma: fix page locking in migrating thp

From: Mel Gorman
Date: Sat Nov 24 2012 - 08:17:27 EST


On Sat, Nov 24, 2012 at 12:27:39PM +0800, Hillf Danton wrote:
> If fail to migrate thp(due to unsuccessful isolation), and if the original
> pmd entry is changed after reaquiring page table lock, it is unsafe to
> release the page lock as page maybe unstable.
>
> It is fixed by raising extra page count before trying migration.
>

Less sure of this one but the locking here is a mess. A reference count
is already taken. Isolating the page takes another reference count so the
first one can be dropped without the page being freed underneath us. The
migration function takes care of unlocking the page on a successful
migration. On unsuccessful migration, the PMD is rechecked under the
lock before clearing the pmd_numa. I'm not sure where you are seeing
the instability but I haven't fired up my brain either (it's the weekend
:)). I'll take a fresh look at this Monday.

Thanks!

--
Mel Gorman
SUSE Labs
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/