Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751428AbdL2Pp4 (ORCPT ); Fri, 29 Dec 2017 10:45:56 -0500 Received: from mail-sn1nam02on0129.outbound.protection.outlook.com ([104.47.36.129]:4192 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751107AbdL2Ppy (ORCPT ); Fri, 29 Dec 2017 10:45:54 -0500 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=zi.yan@cs.rutgers.edu; From: "Zi Yan" To: "Michal Hocko" Cc: linux-mm@kvack.org, "Naoya Horiguchi" , "Kirill A. Shutemov" , "Vlastimil Babka" , "Andrew Morton" , "Andrea Reale" , LKML Subject: Re: [RFC PATCH 3/3] mm: unclutter THP migration Date: Fri, 29 Dec 2017 10:45:46 -0500 X-Mailer: MailMate (1.10r5444) Message-ID: <044496C5-5ACD-4845-A7A3-BD920BF9233B@cs.rutgers.edu> In-Reply-To: <20171229113627.GB27077@dhcp22.suse.cz> References: <20171207143401.GK20234@dhcp22.suse.cz> <20171208161559.27313-1-mhocko@kernel.org> <20171208161559.27313-4-mhocko@kernel.org> <20171229113627.GB27077@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=_MailMate_968C8C0A-88F7-4A68-B1FC-F6AA0EFDF428_="; micalg=pgp-sha512; protocol="application/pgp-signature" X-Originating-IP: [108.53.61.194] X-ClientProxiedBy: MWHPR01CA0047.prod.exchangelabs.com (10.172.172.161) To MWHPR14MB1661.namprd14.prod.outlook.com (10.171.146.143) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d2ada5ba-5bd1-432b-bdcb-08d54ed33d1b X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603307)(7153060);SRVR:MWHPR14MB1661; X-Microsoft-Exchange-Diagnostics: 1;MWHPR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UxC3Pehz/1/gkZVZt7GgAYUs01DoQR37cGeNqmMPJzP+9RoZrW+9QmDfPwaOmxSLXbxflmvAFN11mVIAb5T39xjc/J6nCPbpJliLGnKEe8zZcQx4TkKPTb9PzdBSNnamcbQi8rkceQ8m3/Sm4ysHwqhxyOlzGcE8/l0CG5++bGuYNICK6pmOkT+jtsiWYfa+/9F0xLbmc8TzZ3pPQc0Oc/nQdwybG+bXIQbqkSjyXimK8VtVpqfP9g6GdMu3x3BKNU/yzXBq8vEQUCkS+XlGZm5Cg7D8RBJ5AW5hIsI8r14XzUeUgi3ieJP/cia5tVAwV0tkn4O+1DhG/4o8MLcZKOkJrcYlOqxS3u9bE0K3gs;4:Dx5EGsTCMdmDqL8zuGFldoJ5w65kFX2iXr5F01aT1O8hMgexx5eS+HLlhXHNwVTW45S+UdY+LLnna/rKg7IuiLaTH+DJN1twjkPS3DqpBNtLEBM0dFX9jrvkQ8igV944pzQw/3vCcRKiArZqo3uookAy2oN1EVThhgQPY9QTT8WbkupCadVdyq/8ulp5wI27CpYtY6D7vSNEpDwVimyheouEUNGgDfhRam0N8oqMM0Dm/Yd1GeWuMKkvGljck2n8prduG50Awdu1x2ZmuT9H9g== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040470)(2401047)(8121501046)(5005006)(3231023)(11241501184)(944501075)(93006095)(93001095)(10201501046)(3002001)(6041268)(20161123562045)(20161123558120)(20161123564045)(20161123560045)(201703131423095)(201702281529075)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011);SRVR:MWHPR14MB1661;BCL:0;PCL:0;RULEID:(100000803101)(100110400095);SRVR:MWHPR14MB1661; X-Forefront-PRVS: 0536638EAC X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(6049001)(39380400002)(39860400002)(346002)(366004)(396003)(376002)(199004)(189003)(24454002)(377424004)(51914003)(57704003)(25786009)(81166006)(53936002)(54906003)(568964002)(81156014)(75432002)(84326002)(83716003)(76176011)(117156002)(229853002)(53546011)(386003)(68736007)(86362001)(305945005)(2906002)(6486002)(6666003)(33964004)(16586007)(8676002)(50226002)(786003)(316002)(77096006)(52116002)(6246003)(59450400001)(106356001)(5890100001)(88552002)(8936002)(7736002)(16526018)(3846002)(5660300001)(16576012)(93886005)(66066001)(478600001)(6116002)(90366009)(2950100002)(42882006)(97736004)(105586002)(33656002)(82746002)(6916009)(4326008)(72826003)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:MWHPR14MB1661;H:[192.168.1.153];FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtNV0hQUjE0TUIxNjYxOzIzOnFFcDdpdWRZWDZvWlRVek56VllNWjFoRnht?= =?utf-8?B?dHptQW5UQW9abFFXc3VzaWtvMm5HV0czckUzMC8yS2hHOTJiTTBXWmVYZjdJ?= =?utf-8?B?VHQ0NUN3WksvQ25wbkd1d1ExUktjTVRrd1dVUEJqMUhDSm5JK2tVYkdJRytn?= =?utf-8?B?TUhNTGNxWm1Qd2Fza3BQTi9yaHJpeWpkTjlwNkhzWmZhVTYwdlF4ZnNQRWhs?= =?utf-8?B?a2xBY3REbVNkRkttaFIxbUcxdnZ5d0NOM1hJV3kzWmFidnJPbFVNbG9nbjRF?= =?utf-8?B?Rjk3T0NkYkRaMVgzNlQwTG5VbTdrc3JxVG9OVGdlZDlMcVl4V1FzZTVORHE4?= =?utf-8?B?N2FIUHZyZGhSZXRDNW5YN1FSVE45Zi95OE5mY1lOWVRNVTVxTU9Pa21HTHps?= =?utf-8?B?RHBiTis3Z3VtbVpnWVpseStCZUlNNE1tOWx2citjRzA5Zml6d3lwYUIyR3pW?= =?utf-8?B?b3A4RzVlU3BDeDVaQVFJT0ZBb3JMa1FQY2NwYXhDNFRJVDZSZ0hydC9JcXhW?= =?utf-8?B?MEtoV3ZtNnFVcUFGNVN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p2LPlW2g3AJI5mLJEDtqiWR2bjCJhFm35BXdiKz/houJxyjbjTUQxEU2ADupM=;5:UEQBjZA/yLOD8yFyXZbnjcx8AQJQa7Y8iWur+Y/y9GkJXN/E9LPO9TpEszorAtDuUShnZlO7lu3xI6feruUMHeOg4lQyUTmo1DWYOjsZUO2GjaCvyhrgwoKQG1RNXQhMhasAgeyXdnAbcXKOBF2UnHURzKsFqeW0fAMM63KL0KA=;24:c1CLv949EcvvZHzuHODZfdpT34LL6Hs6LQaDZ7jLV4jwXpySAbyP7kyG22KaJsoZn9q2ho3C8a5JhPcEhjw9Mg0bxQL1PNriH2cF7Hec0Jk=;7:scUdo5FCkvftoXeqq4NbSl7+jOu0wtCj4a3jw1ZTa/I7kJwfWbSJLqzlV4X+0vEE0aAspnv3nUms86eOjhY44QNP99W9u453YxPCknV8sHmBCDlcXPp4u2H008E6SMvEPOTSoGxwSiJKH+Isj3jGHR4WUvwJUSQJfj2dkOzjka2vs1Thw4K0z6+rHKDNhxdz7c2HZZD66Eo2UmHozbK7nz5J3Replhisxl++/OUysEhtViNEqbDXRYbPF0HBLN4h SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: cs.rutgers.edu X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Dec 2017 15:45:50.4493 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d2ada5ba-5bd1-432b-bdcb-08d54ed33d1b X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: b92d2b23-4d35-4470-93ff-69aca6632ffe 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: 3043 Lines: 90 This is an OpenPGP/MIME signed message (RFC 3156 and 4880). --=_MailMate_968C8C0A-88F7-4A68-B1FC-F6AA0EFDF428_= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 29 Dec 2017, at 6:36, Michal Hocko wrote: > On Tue 26-12-17 21:19:35, Zi Yan wrote: >> On 8 Dec 2017, at 11:15, Michal Hocko wrote: > [...] >>> @@ -1394,6 +1390,21 @@ int migrate_pages(struct list_head *from, new_= page_t get_new_page, >>> >>> switch(rc) { >>> case -ENOMEM: >>> + /* >>> + * THP migration might be unsupported or the >>> + * allocation could've failed so we should >>> + * retry on the same page with the THP split >>> + * to base pages. >>> + */ >>> + if (PageTransHuge(page)) { >>> + lock_page(page); >>> + rc =3D split_huge_page_to_list(page, from); >>> + unlock_page(page); >>> + if (!rc) { >>> + list_safe_reset_next(page, page2, lru); >>> + goto retry; >>> + } >>> + } >> >> The hunk splits the THP and adds all tail pages at the end of the list= =E2=80=9Cfrom=E2=80=9D. >> Why do we need =E2=80=9Clist_safe_reset_next(page, page2, lru);=E2=80=9D= here, when page2 is not changed here? > > Because we need to handle the case when the page2 was the last on the > list. Got it. Thanks for the explanation. > >> And it seems a little bit strange to only re-migrate the head page, th= en come back to all tail >> pages after migrating the rest of pages in the list =E2=80=9Cfrom=E2=80= =9D. Is it better to split the THP into >> a list other than =E2=80=9Cfrom=E2=80=9D and insert the list after =E2= =80=9Cpage=E2=80=9D, then retry from the split =E2=80=9Cpage=E2=80=9D? >> Thus, we attempt to migrate all sub pages of the THP after it is split= =2E > > Why does this matter? Functionally, it does not matter. This behavior is just less intuitive and a little different from current = one, which implicitly preserves its original order of the not-migrated pages in the =E2=80=9Cfrom=E2=80=9D list, although no one relies on this implic= it behavior now. Adding one line comment about this difference would be good for code main= tenance. :) Reviewed-by: Zi Yan =E2=80=94 Best Regards, Yan Zi --=_MailMate_968C8C0A-88F7-4A68-B1FC-F6AA0EFDF428_= Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- Comment: GPGTools - https://gpgtools.org iQFKBAEBCgA0FiEEOXBxLIohamfZUwd5QYsvEZxOpswFAlpGYyoWHHppLnlhbkBj cy5ydXRnZXJzLmVkdQAKCRBBiy8RnE6mzCq7B/9XVb6Em/umlP4zwIkYM/rCC+F+ tPdL8LJbfJ01tgVA6MGCe/AUT2Sk8acW39TC0IpUjTUJ6y01dboSK1sEuJU/8sBf as7V/AAHEX6v86aP4Yv3hIlwcmT4Fpwstd0EMqGexS3xYiChM2oSHSOjgvUYo97+ EnUfgY/KUICs8qANdlz6lxeg4IMrnyghgRoXYHaV5MbGaWXk7INMtenluWsD3DL5 HlJMjPOqdFyyfvS/P8S3ntv2bsm3LyfY6XYI6qL3byGL51aJtvB99fmiTyp/8nBI IfiARMg1oHo9qL2ln/8OCPd/Hm4rEbhVzT2aL+ivyTQObTGFA3Val/F10DJ3 =9pEm -----END PGP SIGNATURE----- --=_MailMate_968C8C0A-88F7-4A68-B1FC-F6AA0EFDF428_=--