lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 6 Feb 2017 03:29:57 +0000
From:   Naoya Horiguchi <n-horiguchi@...jp.nec.com>
To:     Yisheng Xie <xieyisheng1@...wei.com>
CC:     "linux-mm@...ck.org" <linux-mm@...ck.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "akpm@...ux-foundation.org" <akpm@...ux-foundation.org>,
        "mhocko@...nel.org" <mhocko@...nel.org>,
        "minchan@...nel.org" <minchan@...nel.org>,
        "ak@...ux.intel.com" <ak@...ux.intel.com>,
        "guohanjun@...wei.com" <guohanjun@...wei.com>,
        "hannes@...xchg.org" <hannes@...xchg.org>,
        "iamjoonsoo.kim@....com" <iamjoonsoo.kim@....com>,
        "mgorman@...hsingularity.net" <mgorman@...hsingularity.net>,
        "arbab@...ux.vnet.ibm.com" <arbab@...ux.vnet.ibm.com>,
        "izumi.taku@...fujitsu.com" <izumi.taku@...fujitsu.com>,
        "vkuznets@...hat.com" <vkuznets@...hat.com>,
        "vbabka@...e.cz" <vbabka@...e.cz>,
        "qiuxishi@...wei.com" <qiuxishi@...wei.com>
Subject: Re: [PATCH v6 4/4] mm/hotplug: enable memory hotplug for non-lru
 movable pages

On Fri, Feb 03, 2017 at 03:59:30PM +0800, Yisheng Xie wrote:
> We had considered all of the non-lru pages as unmovable before commit
> bda807d44454 ("mm: migrate: support non-lru movable page migration").  But
> now some of non-lru pages like zsmalloc, virtio-balloon pages also become
> movable.  So we can offline such blocks by using non-lru page migration.
> 
> This patch straightforwardly adds non-lru migration code, which means
> adding non-lru related code to the functions which scan over pfn and
> collect pages to be migrated and isolate them before migration.
> 
> Signed-off-by: Yisheng Xie <xieyisheng1@...wei.com>
> Cc: Michal Hocko <mhocko@...nel.org>
> Cc: Minchan Kim <minchan@...nel.org>
> Cc: Naoya Horiguchi <n-horiguchi@...jp.nec.com>
> Cc: Vlastimil Babka <vbabka@...e.cz>
> Cc: Andi Kleen <ak@...ux.intel.com>
> Cc: Hanjun Guo <guohanjun@...wei.com>
> Cc: Johannes Weiner <hannes@...xchg.org>
> Cc: Joonsoo Kim <iamjoonsoo.kim@....com>
> Cc: Mel Gorman <mgorman@...hsingularity.net>
> Cc: Reza Arbab <arbab@...ux.vnet.ibm.com>
> Cc: Taku Izumi <izumi.taku@...fujitsu.com>
> Cc: Vitaly Kuznetsov <vkuznets@...hat.com>
> Cc: Xishi Qiu <qiuxishi@...wei.com>
> ---
>  mm/memory_hotplug.c | 28 +++++++++++++++++-----------
>  mm/page_alloc.c     |  8 ++++++--
>  2 files changed, 23 insertions(+), 13 deletions(-)
> 
> diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
> index ca2723d..ea1be08 100644
> --- a/mm/memory_hotplug.c
> +++ b/mm/memory_hotplug.c
> @@ -1516,10 +1516,10 @@ int test_pages_in_a_zone(unsigned long start_pfn, unsigned long end_pfn)
>  }
>  
>  /*
> - * Scan pfn range [start,end) to find movable/migratable pages (LRU pages
> - * and hugepages). We scan pfn because it's much easier than scanning over
> - * linked list. This function returns the pfn of the first found movable
> - * page if it's found, otherwise 0.
> + * Scan pfn range [start,end) to find movable/migratable pages (LRU pages,
> + * non-lru movable pages and hugepages). We scan pfn because it's much
> + * easier than scanning over linked list. This function returns the pfn
> + * of the first found movable page if it's found, otherwise 0.
>   */
>  static unsigned long scan_movable_pages(unsigned long start, unsigned long end)
>  {
> @@ -1530,6 +1530,8 @@ static unsigned long scan_movable_pages(unsigned long start, unsigned long end)
>  			page = pfn_to_page(pfn);
>  			if (PageLRU(page))
>  				return pfn;
> +			if (__PageMovable(page))
> +				return pfn;
>  			if (PageHuge(page)) {
>  				if (page_huge_active(page))
>  					return pfn;
> @@ -1606,21 +1608,25 @@ static struct page *new_node_page(struct page *page, unsigned long private,
>  		if (!get_page_unless_zero(page))
>  			continue;
>  		/*
> -		 * We can skip free pages. And we can only deal with pages on
> -		 * LRU.
> +		 * We can skip free pages. And we can deal with pages on
> +		 * LRU and non-lru movable pages.
>  		 */
> -		ret = isolate_lru_page(page);
> +		if (PageLRU(page))
> +			ret = isolate_lru_page(page);
> +		else
> +			ret = isolate_movable_page(page, ISOLATE_UNEVICTABLE);
>  		if (!ret) { /* Success */
>  			put_page(page);
>  			list_add_tail(&page->lru, &source);
>  			move_pages--;
> -			inc_node_page_state(page, NR_ISOLATED_ANON +
> -					    page_is_file_cache(page));
> +			if (!__PageMovable(page))

If this check is identical with "if (PageLRU(page))" in this context,
PageLRU(page) looks better because you already add same "if" above.

Otherwise, looks good to me.

Thanks,
Naoya Horiguchi

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ