Re: [PATCH 6/8] HWPOISON, hugetlb: soft offlining for hugepage

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> +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, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxxx  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]