From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752719Ab3B0H1V (ORCPT ); Wed, 27 Feb 2013 02:27:21 -0500 Received: from mga01.intel.com ([192.55.52.88]:23802 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750749Ab3B0H1T (ORCPT ); Wed, 27 Feb 2013 02:27:19 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.84,746,1355126400"; d="asc'?scan'208";a="296476411" Date: Wed, 27 Feb 2013 02:25:17 -0500 From: Chen Gong To: Naoya Horiguchi Cc: linux-mm@kvack.org, Andrew Morton , Mel Gorman , Hugh Dickins , KOSAKI Motohiro , Andi Kleen , linux-kernel@vger.kernel.org Subject: Re: [PATCH 3/9] soft-offline: use migrate_pages() instead of migrate_huge_page() Message-ID: <20130227072517.GA30971@gchen.bj.intel.com> Mail-Followup-To: Naoya Horiguchi , linux-mm@kvack.org, Andrew Morton , Mel Gorman , Hugh Dickins , KOSAKI Motohiro , Andi Kleen , linux-kernel@vger.kernel.org References: <1361475708-25991-1-git-send-email-n-horiguchi@ah.jp.nec.com> <1361475708-25991-4-git-send-email-n-horiguchi@ah.jp.nec.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="MGYHOYXEY6WxJCY8" Content-Disposition: inline In-Reply-To: <1361475708-25991-4-git-send-email-n-horiguchi@ah.jp.nec.com> X-PGP-Key-ID: A43922C7 User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --MGYHOYXEY6WxJCY8 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Feb 21, 2013 at 02:41:42PM -0500, Naoya Horiguchi wrote: > Date: Thu, 21 Feb 2013 14:41:42 -0500 > From: Naoya Horiguchi > To: linux-mm@kvack.org > Cc: Andrew Morton , Mel Gorman , > Hugh Dickins , KOSAKI Motohiro > , Andi Kleen , > linux-kernel@vger.kernel.org > Subject: [PATCH 3/9] soft-offline: use migrate_pages() instead of > migrate_huge_page() >=20 > Currently migrate_huge_page() takes a pointer to a hugepage to be > migrated as an argument, instead of taking a pointer to the list of > hugepages to be migrated. This behavior was introduced in commit > 189ebff28 ("hugetlb: simplify migrate_huge_page()"), and was OK > because until now hugepage migration is enabled only for soft-offlining > which takes only one hugepage in a single call. >=20 > But the situation will change in the later patches in this series > which enable other users of page migration to support hugepage migration. > They can kick migration for both of normal pages and hugepages > in a single call, so we need to go back to original implementation > of using linked lists to collect the hugepages to be migrated. >=20 > Signed-off-by: Naoya Horiguchi > --- > mm/memory-failure.c | 20 ++++++++++++++++---- > mm/migrate.c | 2 ++ > 2 files changed, 18 insertions(+), 4 deletions(-) >=20 > diff --git v3.8.orig/mm/memory-failure.c v3.8/mm/memory-failure.c > index bc126f6..01e4676 100644 > --- v3.8.orig/mm/memory-failure.c > +++ v3.8/mm/memory-failure.c > @@ -1467,6 +1467,7 @@ static int soft_offline_huge_page(struct page *page= , int flags) > int ret; > unsigned long pfn =3D page_to_pfn(page); > struct page *hpage =3D compound_head(page); > + LIST_HEAD(pagelist); > =20 > /* Synchronized using the page lock with memory_failure() */ > lock_page(hpage); > @@ -1479,13 +1480,24 @@ static int soft_offline_huge_page(struct page *pa= ge, int flags) > unlock_page(hpage); > =20 > /* Keep page count to indicate a given hugepage is isolated. */ > - ret =3D migrate_huge_page(hpage, new_page, MPOL_MF_MOVE_ALL, false, > - MIGRATE_SYNC); > - put_page(hpage); > + list_move(&hpage->lru, &pagelist); > + ret =3D migrate_pages(&pagelist, new_page, MPOL_MF_MOVE_ALL, false, > + MIGRATE_SYNC, MR_MEMORY_FAILURE); > if (ret) { > pr_info("soft offline: %#lx: migration failed %d, type %lx\n", > pfn, ret, page->flags); > - return ret; > + /* > + * We know that soft_offline_huge_page() tries to migrate > + * only one hugepage pointed to by hpage, so we need not > + * run through the pagelist here. > + */ > + putback_active_hugepage(hpage); > + if (ret > 0) > + ret =3D -EIO; > + } else { > + set_page_hwpoison_huge_page(hpage); > + dequeue_hwpoisoned_huge_page(hpage); > + atomic_long_add(1<