Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1041329AbdDUP4V (ORCPT ); Fri, 21 Apr 2017 11:56:21 -0400 Received: from mail-bn3nam01on0120.outbound.protection.outlook.com ([104.47.33.120]:23219 "EHLO NAM01-BN3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1041307AbdDUP4E (ORCPT ); Fri, 21 Apr 2017 11:56:04 -0400 Authentication-Results: linux.vnet.ibm.com; dkim=none (message not signed) header.d=none;linux.vnet.ibm.com; dmarc=none action=none header.from=cs.rutgers.edu; Message-ID: <58FA2B85.5040904@cs.rutgers.edu> Date: Fri, 21 Apr 2017 10:55:49 -0500 From: Zi Yan User-Agent: Postbox 5.0.12 (Windows/20170323) MIME-Version: 1.0 To: Anshuman Khandual , n-horiguchi@ah.jp.nec.com CC: Zi Yan , kirill.shutemov@linux.intel.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, akpm@linux-foundation.org, minchan@kernel.org, vbabka@suse.cz, mgorman@techsingularity.net, mhocko@kernel.org, dnellans@nvidia.com Subject: Re: [PATCH v5 08/11] mm: hwpoison: soft offline supports thp migration References: <20170420204752.79703-1-zi.yan@sent.com> <20170420204752.79703-9-zi.yan@sent.com> <62d7eea3-96c8-3230-3e1b-fdc2bfbea6bd@linux.vnet.ibm.com> In-Reply-To: <62d7eea3-96c8-3230-3e1b-fdc2bfbea6bd@linux.vnet.ibm.com> X-Enigmail-Version: 1.2.3 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------enigC72BC6CAB1D8BE27109B1681" X-Originating-IP: [12.1.252.66] X-ClientProxiedBy: MWHPR15CA0044.namprd15.prod.outlook.com (10.173.226.158) To MWHPR14MB1661.namprd14.prod.outlook.com (10.171.146.143) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e56f1aad-830a-4c92-0723-08d488cee55e X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(201703131423075)(201703031133081);SRVR:MWHPR14MB1661; X-Microsoft-Exchange-Diagnostics: 1;MWHPR14MB1661;3:dKj641xm+IyrbJ8oOo1yvm1vu9ANFbZM0vCQ7A/VNbYImSP0eZffC3KaO57YKDe3/yMh1x/f1wWbAbDonnm2R/ptlhQyI7SmFzA6T4ciDp7zUqOH312vm05/GtPSzT46mHKmHMTl3ry1G91Gn/4UoG84CafNxni1RTKHbuQQZW22nqVY4UfKcprA7l1WMCMwaZGch1OIKDttGKR9EmVN5I8ujLPr+ID9v7DhZ9Ev4d2O8NoA7iknUzKuKEYtouLA/UeJtoYe9J+DU0vHWEZiudMJHcrSte/bCy9iFjDh/plXuS7im2XhbAru/34RgnLXorFLVkqtXusRsjGGB2xDYQ==;25:VigrpJJgfAggvL+oWEsQmJ/eZBI5qDH2WqTqHbMbOF8rJu4Ra6FCJc+qTEHXq1D9yeSchx4DziXspFMqwjpzXlsBBADw4IwxxP67nETQwa+opxJyi4nDI2Cx83sVudmwCToArbJXvNoF7uszlxgbNhRmxrIg9kMhOpC9nRldX3AV3aKavT16ssAgxMGc27QG17ODzBibbGtyERPLuaI0ZiXGZS670YsONFbprzzApAs1P4Z2XyobeB5RhrWyKvpofkPiyBpgZio7WDBANYO7J1G0BBW8sXO33p1U+MLWY9rrxLtwBgyMKIcCz/N4uNTSQ/j5B/3ZlbKyYgKpxW+dp0IBUvro1q4vhWjxUO7I/o/Q0KGtsAg/cOgvdPpDqj2CMOGAl+Rp56+8VUenB1nMwtTfARhS7hN62pAoOQwZtvTiE4SPLiRQzdLxQCS0scyl7WGtaM6LnNH4Mf016zOzFw== X-Microsoft-Exchange-Diagnostics: 1;MWHPR14MB1661;31:3iFBl+fNqr+vJCtz9ptxZ3YXGpUmiXaJOvh9pKz0l8HSjXScoGIsK0LCngWAa1v8oXhtVfUqb3A7Eb1NLW9MltQScBciDW7OnC8RY33KoIHzrG4pZn4/Q0AbKJy3swSQRZdK6nYebPHSYE+s+/aElt9GiR3k0mvn+IqiFPdI+kyZmbSCFVCl5fzAtAW/woIY8DrJ4ISQhPx+bqjoXqX5E0o+biT5+Zir0UNieu+j2YjnSGiLFATVJerfO5PwpAJH;20:Npi9r9JngXOlPHQc23zqXfGy+j3JZCCbSWret47Kl7R+eut+wMsp9KDmgzMPOhbB+s1vlNv75TV/ycbFw5jOt3pJobtj+2KibuYAoZqIP2H7FkwqhnekJVVdwld4+HGQ/NtMji7Jo3csshR41ozrCN7AXCkcNga+eBKc0J8sYPuqBeyEOBAiQvXQRRfk1MZn+ycMDsZqDDjCaBpl9D5LRsdgBlSUnpbrjIcT3qIJ94qllBRMjOYSG2qY3iQkSosU6a/PCNCaO1s1satpuQqSJnT25PP9zls69ymf9tx4/dZHpUGAQD0cDfppHaWmPqLuWrOxUFW2yBR0iNEqqpyiXWZgeerlJIORAbh1htL3gTeZ6XaRfkC8tsrkDObddHQcUXA0jJw6+W2XhiyUz/wapaNQygaJB2wzS+/cJoHmC8tlcTI48Gn0pPVcxdShd1sOolVCfDEc+ZIK5iaAXhezr+1sgZUNFOvItth0J6emOZdUNepoPmNSc4O73KImnD3k X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040450)(601004)(2401047)(5005006)(8121501046)(93006095)(93001095)(10201501046)(3002001)(6041248)(20161123555025)(20161123562025)(20161123564025)(20161123560025)(201703131423075)(201702281529075)(201702281528075)(201703061421075)(6072148);SRVR:MWHPR14MB1661;BCL:0;PCL:0;RULEID:;SRVR:MWHPR14MB1661; X-Microsoft-Exchange-Diagnostics: 1;MWHPR14MB1661;4:F7mwZWH7rPWHpKKuZ83cu3Nux45baeWAJU1dojwSGJz1cAghmkhT7ywo3nkcVMUqRiBjkdB1Erhk4UPx0f0awJtqMgsDsoV/x8+UwhZ9EvjXaVEILp0u37HyAulrFG04QDddWEwWRV8izCVsA4F0WGkBQfLyE34iNQDvCfzuxtPQRyEdbW9CSKGdsWQGVPnz8giq5AgyxDTmOHJHTnYa3u1ZrJQ+Pz2E6wIgA2vA62Pp1oLg+SRsSD0WSZlTZn+gJfY/WErQa60t2ta9Tt9a8qORBcPDD47Mjnd3hODdMux+gye/9bSzWVEQdgFGKcGzMEpZw8Fx5NXL8lsrF57+X9FCKWZvSlVDJEVG8Bj2qDwm5yTNNUOrBjcmuBGqTHLtU7zMBZUqi6AErwt+WqGAjy7MeoHlxwKQ3j0LjsdRPXOBDxvOf2GmNzeuawpmphyNylwQdnmiPW8Q8/JglKmz429V/IXXeXJN7BKELotY08xEMPC0mlSkq1H9s7ht5woKdYGJv0G4LdakEus1Qof7IZUjDQo+M7xAZPQ9cbwjMppfhD9llVbQF73wgr9nzeHtC5MO2o0ZY0bNZjwTHgT67VYFpnY1i9PxHapqVeYbkYRLg2gbhPMcvggFE2/KrG9Nm/bLBLl95JOgLhKvA5z4rcz/W8riG9ZHcmQAQ+fzyxIe549S9IibPQpckqaAYfDmWheeT68uSgRg94SBpJy5TXhbcrgiBut82myPV/AF4wOa4m+76B/QaZt7t2kgz6u3 X-Forefront-PRVS: 02843AA9E0 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(4630300001)(6009001)(6049001)(39450400003)(39400400002)(39840400002)(39860400002)(39410400002)(39850400002)(377454003)(24454002)(76104003)(229853002)(568964002)(5660300001)(88552002)(4326008)(53546009)(7416002)(25786009)(42186005)(2906002)(21480400002)(3846002)(6116002)(110136004)(38730400002)(80316001)(81166006)(59896002)(189998001)(33656002)(4001350100001)(66066001)(6246003)(7736002)(75432002)(90366009)(305945005)(8656002)(6486002)(77096006)(2950100002)(42882006)(53936002)(8676002)(50986999)(54356999)(87266999)(76176999)(83506001)(86362001)(65816999)(5890100001)(84326002)(6666003);DIR:OUT;SFP:1102;SCL:1;SRVR:MWHPR14MB1661;H:[10.20.179.35];FPR:;SPF:None;MLV:sfv;LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;MWH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f9N/AGuewoHKWUm26XsT1nR7QqtQmsy4gnwpYvyeGen+t4b13ATqQS1DkPHl6ALriDJYdHjOuihlxgLRFHGT19SzQ6wMQC0L1nxXRj7uTpk5jNJL434Tru56/ZSRLSxyKZywgw==;5:cRH30MSNEDdBSV3Mtmznkk27PcgOQakdmstvwdyyGgOxtjDNOirKCnhBwK5drNSeHT5pLNbVQsL9rygMXJfZwaOJHUs3E5/ADoLs5G15dT+o55K8JbgIkKghSQ8bVGT044DH9f48vuPeswo++JAJfA==;24:BVbFFZh3m1Smx/4TtCDx5XSZN/8GEjR0xuX88qePBYDJijUbVr20BAPPqVRkh8GmrElhMxNgmPFZ0Kl3NalB3W7RKpY4JllpxIY2iRsMMxs= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;MWHPR14MB1661;7:a2rVBfg+Dy2jtsloLtlp65c+TRAoeuEnchrdXiJ2vJbkhSRdkqQQvnipQnEe7tCAykcQEOnLHLmZVUGrktrxGNt2vf6Imlyw9bGFNBx2sbv02Rx828tzuGjYcIgcX1MMtT0mpNkH07hriz9vwCfH5sjGkDjRFMwfknJXlHiEgSuhMuaHY46GAsAfouvZiM1CZZn/1aiGaE789NXpjPtEisIGejIKIu56ebkEEB58k9WiIx/rzLT6DBgl3c3tlQoo+blivR0fCWe67sVieRuwQT4EHJh8xv/u1U2bwU0TyxYO5La18BV2VJZ3ow5fHSiUzwcOO2RXQD5EVxM+xXGuTg== X-OriginatorOrg: cs.rutgers.edu X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Apr 2017 15:55:54.0273 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR14MB1661 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 4965 Lines: 146 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigC72BC6CAB1D8BE27109B1681 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Anshuman Khandual wrote: > On 04/21/2017 02:17 AM, Zi Yan wrote: >> From: Naoya Horiguchi >> >> This patch enables thp migration for soft offline. >> >> Signed-off-by: Naoya Horiguchi >> >> ChangeLog: v1 -> v5: >> - fix page isolation counting error >> >> Signed-off-by: Zi Yan >> --- >> mm/memory-failure.c | 35 ++++++++++++++--------------------- >> 1 file changed, 14 insertions(+), 21 deletions(-) >> >> diff --git a/mm/memory-failure.c b/mm/memory-failure.c >> index 9b77476ef31f..23ff02eb3ed4 100644 >> --- a/mm/memory-failure.c >> +++ b/mm/memory-failure.c >> @@ -1481,7 +1481,17 @@ static struct page *new_page(struct page *p, un= signed long private, int **x) >> if (PageHuge(p)) >> return alloc_huge_page_node(page_hstate(compound_head(p)), >> nid); >> - else >> + else if (thp_migration_supported() && PageTransHuge(p)) { >> + struct page *thp; >> + >> + thp =3D alloc_pages_node(nid, >> + (GFP_TRANSHUGE | __GFP_THISNODE) & ~__GFP_RECLAIM, >=20 > Why not __GFP_RECLAIM ? Its soft offline path we wait a bit before > declaring that THP page cannot be allocated and hence should invoke > reclaim methods as well. I am not sure how much effort the kernel wants to put here to soft offline a THP. Naoya knows more here. >=20 >> + HPAGE_PMD_ORDER); >> + if (!thp) >> + return NULL; >> + prep_transhuge_page(thp); >> + return thp; >> + } else >> return __alloc_pages_node(nid, GFP_HIGHUSER_MOVABLE, 0); >> } >> =20 >> @@ -1665,8 +1675,8 @@ static int __soft_offline_page(struct page *page= , int flags) >> * cannot have PAGE_MAPPING_MOVABLE. >> */ >> if (!__PageMovable(page)) >> - inc_node_page_state(page, NR_ISOLATED_ANON + >> - page_is_file_cache(page)); >> + mod_node_page_state(page_pgdat(page), NR_ISOLATED_ANON + >> + page_is_file_cache(page), hpage_nr_pages(page)); >> list_add(&page->lru, &pagelist); >> ret =3D migrate_pages(&pagelist, new_page, NULL, MPOL_MF_MOVE_ALL, >> MIGRATE_SYNC, MR_MEMORY_FAILURE); >> @@ -1689,28 +1699,11 @@ static int __soft_offline_page(struct page *pa= ge, int flags) >> static int soft_offline_in_use_page(struct page *page, int flags) >> { >> int ret; >> - struct page *hpage =3D compound_head(page); >> - >> - if (!PageHuge(page) && PageTransHuge(hpage)) { >> - lock_page(hpage); >> - if (!PageAnon(hpage) || unlikely(split_huge_page(hpage))) { >> - unlock_page(hpage); >> - if (!PageAnon(hpage)) >> - pr_info("soft offline: %#lx: non anonymous thp\n", page_to_pfn(pa= ge)); >> - else >> - pr_info("soft offline: %#lx: thp split failed\n", page_to_pfn(pag= e)); >> - put_hwpoison_page(hpage); >> - return -EBUSY; >> - } >> - unlock_page(hpage); >> - get_hwpoison_page(page); >> - put_hwpoison_page(hpage); >> - } >> =20 >> if (PageHuge(page)) >> ret =3D soft_offline_huge_page(page, flags); >> else >> - ret =3D __soft_offline_page(page, flags); >> + ret =3D __soft_offline_page(compound_head(page), flags); >=20 > Hmm, what if the THP allocation fails in the new_page() path and > we fallback for general page allocation. In that case we will > always be still calling with the head page ? Because we dont > split the huge page any more. This could be a problem if the user wants to offline a TailPage but due to THP allocation failure, the HeadPage is offlined. It may be better to only soft offline THPs if page =3D=3D compound_head(page). If page !=3D compound_head(page), we still split THP= s like before. Because in migrate_pages(), we cannot guarantee any TailPages in that THP are migrated (1. THP allocation failure causes THP splitting, then only HeadPage is going to be migrated; 2. even if we change existing migrate_pages() implementation to add all TailPages to migration list instead of LRU list, we still cannot guarantee the TailPage we want to migrate is migrated.). Naoya, what do you think? --=20 Best Regards, Yan Zi --------------enigC72BC6CAB1D8BE27109B1681 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQEcBAEBCAAGBQJY+iuGAAoJEEGLLxGcTqbMvzgIAKvEJxRsKtww6QWv7C+7Iaqp s8y48C/efwK5m+krsSLkZ/y3i1q/vBBKndobWY43D0d6EmvDW4o/LsXWXr86Wth/ 9j9Gd7Tcw3+wR9vYOpe9faVfjRnT+8jIbdKgxVvVEUbgnpg11tTORXJSjMM2K7QI I75RZk2Rhh+dB3ylDYymQ66y6fDj+WUvx+rvQcp2NQWAMSXPUIX0Klx4VmyRabsY v66h8+WT4Oj9kWgIRGPntBvI66XVyIXqVPGVY0wZ9wk97+TYrI+fvFCSkoayIFF5 SH/M1lE50AKdnKx2PpD42MGC3pFzdXmkphnsB7c36wQHHS5TApn9Jaf7G19OsNo= =c70J -----END PGP SIGNATURE----- --------------enigC72BC6CAB1D8BE27109B1681--