[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20100825030202.GB15129@localhost>
Date: Wed, 25 Aug 2010 11:02:02 +0800
From: Wu Fengguang <fengguang.wu@...el.com>
To: Naoya Horiguchi <n-horiguchi@...jp.nec.com>
Cc: Andi Kleen <andi@...stfloor.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Christoph Lameter <cl@...ux-foundation.org>,
Mel Gorman <mel@....ul.ie>,
Jun'ichi Nomura <j-nomura@...jp.nec.com>,
linux-mm <linux-mm@...ck.org>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 6/8] HWPOISON, hugetlb: soft offlining for hugepage
> +static int is_hugepage_on_freelist(struct page *hpage)
> +{
> + struct page *page;
> + struct page *tmp;
> + struct hstate *h = page_hstate(hpage);
> + int nid = page_to_nid(hpage);
> +
> + spin_lock(&hugetlb_lock);
> + list_for_each_entry_safe(page, tmp, &h->hugepage_freelists[nid], lru) {
> + if (page == hpage) {
> + spin_unlock(&hugetlb_lock);
> + return 1;
> + }
> + }
> + spin_unlock(&hugetlb_lock);
> + return 0;
> +}
Ha! That looks better than the page_count test in my previous email.
> +void isolate_hwpoisoned_huge_page(struct page *hpage)
> +{
> + lock_page(hpage);
> + if (is_hugepage_on_freelist(hpage))
> + __isolate_hwpoisoned_huge_page(hpage);
> + unlock_page(hpage);
> +}
However it should still be racy if the test/isolate actions are
not performed in the same hugetlb_lock.
Thanks,
Fengguang
--
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