[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20171129095106.q6pvltcouq567tz7@dhcp22.suse.cz>
Date: Wed, 29 Nov 2017 10:51:06 +0100
From: Michal Hocko <mhocko@...nel.org>
To: linux-mm@...ck.org
Cc: Mike Kravetz <mike.kravetz@...cle.com>,
Naoya Horiguchi <n-horiguchi@...jp.nec.com>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH RFC 2/2] mm, hugetlb: do not rely on overcommit limit
during migration
On Tue 28-11-17 15:12:11, Michal Hocko wrote:
[...]
> +/*
> + * Internal hugetlb specific page flag. Do not use outside of the hugetlb
> + * code
> + */
> +static inline bool PageHugeTemporary(struct page *page)
> +{
> + if (!PageHuge(page))
> + return false;
> +
> + return page[2].flags == -1U;
> +}
> +
> +static inline void SetPageHugeTemporary(struct page *page)
> +{
> + page[2].flags = -1U;
> +}
> +
> +static inline void ClearPageHugeTemporary(struct page *page)
> +{
> + page[2].flags = 0;
> +}
Ups, this is obviously not OK. I was just lucky to not hit BUG_ONs
because I am clearly overwriting node/zone data in flags. I will have to
find something else to abuse. I will go with my favorite mapping pointer
which is not used at all.
---
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 1be43563e226..db7544a0b7b6 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -1259,17 +1259,17 @@ static inline bool PageHugeTemporary(struct page *page)
if (!PageHuge(page))
return false;
- return page[2].flags == -1U;
+ return page[2].mapping == -1U;
}
static inline void SetPageHugeTemporary(struct page *page)
{
- page[2].flags = -1U;
+ page[2].mapping = -1U;
}
static inline void ClearPageHugeTemporary(struct page *page)
{
- page[2].flags = 0;
+ page[2].mapping = NULL;
}
void free_huge_page(struct page *page)
--
Michal Hocko
SUSE Labs
Powered by blists - more mailing lists