Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1640301

Re: [PATCH] mm/madvise: Dont poison entire HugeTLB page for single page errors

Path csiph.com!news.redatomik.org!aioe.org!bofh.it!news.nic.it!robomod
From Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Newsgroups linux.kernel
Subject Re: [PATCH] mm/madvise: Dont poison entire HugeTLB page for single page errors
Date Fri, 12 May 2017 10:20:01 +0200
Message-ID <tGdXP-1DJ-3@gated-at.bofh.it> (permalink)
References <tycvT-4JA-1@gated-at.bofh.it> <tyi8i-8cx-21@gated-at.bofh.it>
X-Original-To Anshuman Khandual <khandual@linux.vnet.ibm.com>
Thread-Topic [PATCH] mm/madvise: Dont poison entire HugeTLB page for single page errors
Thread-Index AQHSyvcnX0cXWHtodE2ZTEXVdsPt2Q==
Accept-Language en-US, ja-JP
Content-Language ja-JP
X-Originating-IP [10.128.101.13]
Content-Type text/plain; charset="iso-2022-jp"
Content-ID <57BB4D2CF3C3E44FA7F709499D589F35@gisp.nec.co.jp>
Content-Transfer-Encoding 8BIT
MIME-Version 1.0
X-Tm-As-Mml disable
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 84
Organization linux.* mail to news gateway
X-Original-Cc "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>, "linux-mm@kvack.org" <linux-mm@kvack.org>, "akpm@linux-foundation.org" <akpm@linux-foundation.org>, "aneesh.kumar@linux.vnet.ibm.com" <aneesh.kumar@linux.vnet.ibm.com>
X-Original-Date Fri, 12 May 2017 08:10:01 +0000
X-Original-Message-ID <20170512081001.GA13069@hori1.linux.bs1.fc.nec.co.jp>
X-Original-References <893ecbd7-e9fa-7a54-fc62-43f8a5b8107f@linux.vnet.ibm.com> <20170420110627.12307-1-khandual@linux.vnet.ibm.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1640301

Show key headers only | View raw


On Thu, Apr 20, 2017 at 04:36:27PM +0530, Anshuman Khandual wrote:
> Currently soft_offline_page() migrates the entire HugeTLB page, then
> dequeues it from the active list by making it a dangling HugeTLB page
> which ofcourse can not be used further and marks the entire HugeTLB
> page as poisoned. This might be a costly waste of memory if the error
> involved affects only small section of the entire page.
> 
> This changes the behaviour so that only the affected page is marked
> poisoned and then the HugeTLB page is released back to buddy system.

Hi Anshuman,

This is a good catch, and we can solve this issue now because freeing
hwpoisoned page (previously forbidden) is available now.

And I'm thinking that the same issue for hard/soft-offline on free
hugepages can be solved, so I'll submit a patchset which includes
updated version of your patch.

Thanks,
Naoya Horiguchi

> 
> Signed-off-by: Anshuman Khandual <khandual@linux.vnet.ibm.com>
> ---
> The number of poisoned pages on the system has reduced as seen from
> dmesg triggered with 'echo m > /proc/sysrq-enter' on powerpc.
> 
>  include/linux/hugetlb.h | 1 +
>  mm/hugetlb.c            | 2 +-
>  mm/memory-failure.c     | 9 ++++-----
>  3 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
> index 7a5917d..f6b80a4 100644
> --- a/include/linux/hugetlb.h
> +++ b/include/linux/hugetlb.h
> @@ -470,6 +470,7 @@ static inline pgoff_t basepage_index(struct page *page)
>  	return __basepage_index(page);
>  }
>  
> +extern int dissolve_free_huge_page(struct page *page);
>  extern int dissolve_free_huge_pages(unsigned long start_pfn,
>  				    unsigned long end_pfn);
>  static inline bool hugepage_migration_supported(struct hstate *h)
> diff --git a/mm/hugetlb.c b/mm/hugetlb.c
> index 1edfdb8..2fb9ba3 100644
> --- a/mm/hugetlb.c
> +++ b/mm/hugetlb.c
> @@ -1444,7 +1444,7 @@ static int free_pool_huge_page(struct hstate *h, nodemask_t *nodes_allowed,
>   * number of free hugepages would be reduced below the number of reserved
>   * hugepages.
>   */
> -static int dissolve_free_huge_page(struct page *page)
> +int dissolve_free_huge_page(struct page *page)
>  {
>  	int rc = 0;
>  
> diff --git a/mm/memory-failure.c b/mm/memory-failure.c
> index 27f7210..1e377fd 100644
> --- a/mm/memory-failure.c
> +++ b/mm/memory-failure.c
> @@ -1597,13 +1597,12 @@ static int soft_offline_huge_page(struct page *page, int flags)
>  			ret = -EIO;
>  	} else {
>  		/* overcommit hugetlb page will be freed to buddy */
> +		SetPageHWPoison(page);
> +		num_poisoned_pages_inc();
> +
>  		if (PageHuge(page)) {
> -			set_page_hwpoison_huge_page(hpage);
>  			dequeue_hwpoisoned_huge_page(hpage);
> -			num_poisoned_pages_add(1 << compound_order(hpage));
> -		} else {
> -			SetPageHWPoison(page);
> -			num_poisoned_pages_inc();
> +			dissolve_free_huge_page(hpage);
>  		}
>  	}
>  	return ret;
> -- 
> 1.8.5.2
> 
> 

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Re: [PATCH] mm/madvise: Dont poison entire HugeTLB page for single  page errors Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> - 2017-05-12 10:20 +0200
  Re: [PATCH] mm/madvise: Dont poison entire HugeTLB page for single  page errors Anshuman Khandual <khandual@linux.vnet.ibm.com> - 2017-05-14 04:40 +0200

csiph-web