Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752577AbeAESl0 (ORCPT + 1 other); Fri, 5 Jan 2018 13:41:26 -0500 Received: from resqmta-ch2-12v.sys.comcast.net ([69.252.207.44]:55640 "EHLO resqmta-ch2-12v.sys.comcast.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752438AbeAESlY (ORCPT ); Fri, 5 Jan 2018 13:41:24 -0500 Date: Fri, 5 Jan 2018 12:41:22 -0600 (CST) From: Christopher Lameter X-X-Sender: cl@nuc-kabylake To: Michal Hocko cc: Anshuman Khandual , Andrew Morton , Zi Yan , Naoya Horiguchi , "Kirill A. Shutemov" , Vlastimil Babka , Andrea Reale , linux-mm@kvack.org, LKML Subject: Re: [PATCH 1/3] mm, numa: rework do_pages_move In-Reply-To: <20180105180905.GR2801@dhcp22.suse.cz> Message-ID: References: <20180103082555.14592-1-mhocko@kernel.org> <20180103082555.14592-2-mhocko@kernel.org> <20180105091443.GJ2801@dhcp22.suse.cz> <20180105093301.GK2801@dhcp22.suse.cz> <20180105180905.GR2801@dhcp22.suse.cz> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-CMAE-Envelope: MS4wfJhc2enWQOwr7RDmfpuSxvIFFTIj+rudpHKL+lcpo0DinJRWEqQ0gjT31x53dgoS53gA4nogFSxJUPSkTIkiD41xEzVoNJAIspHreIlaOdcfm4dTuAG/ 3WMHw5FbOty8Uhc/h6Hoj8LCEnDMvdoNZ5lbGez7iJQmZOf7mYb5ib9WrLSg0prl4s2T6r3NIRhCM2IBAL+fzhwx8qJwUTd3kbUkYaK5cgtgHUPjxWUzNa2R 0k6IfIB/Xc6/JK0BdaGOz6CMUa64wZdFhnIO6Jo9IpOetBgpDeVtgxY8qc3A1nRCkc+uGKydAcSZaurek1Qm0wpbvBEQigyktclpLiTaEWtN0Op9LLVEY79X lIQmunAauvKWi8cKOQA44namNxOol3AiSR84MzDQRhZ/J3U2RSBOfk+ctTIP8GWs10x8Ir9A6cr7qAK6qeWqvJ3/rmqgrFy4ZFAPFZz2uE+KebQbBQQ= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: On Fri, 5 Jan 2018, Michal Hocko wrote: > I believe there should be some cap on the number of pages. We shouldn't > keep it held for million of pages if all of them are moved to the same > node. I would really like to postpone that to later unless it causes > some noticeable regressions because this would complicate the code > further and I am not sure this is all worth it. Attached a patch to make the code more readable. Also why are you migrating the pages on pagelist if a add_page_for_migration() fails? One could simply update the status in user space and continue. Index: linux/mm/migrate.c =================================================================== --- linux.orig/mm/migrate.c +++ linux/mm/migrate.c @@ -1584,16 +1584,20 @@ static int do_pages_move(struct mm_struc if (!node_isset(node, task_nodes)) goto out_flush; - if (current_node == NUMA_NO_NODE) { - current_node = node; - start = i; - } else if (node != current_node) { - err = do_move_pages_to_node(mm, &pagelist, current_node); - if (err) - goto out; - err = store_status(status, start, current_node, i - start); - if (err) - goto out; + if (node != current_node) { + + if (current_node != NUMA_NO_NODE) { + + /* Move the pages to current_node */ + err = do_move_pages_to_node(mm, &pagelist, current_node); + if (err) + goto out; + + err = store_status(status, start, current_node, i - start); + if (err) + goto out; + } + start = i; current_node = node; } @@ -1607,6 +1611,10 @@ static int do_pages_move(struct mm_struc if (!err) continue; + /* + * Failure to isolate a page so flush the pages on + * pagelist after storing status and continue. + */ err = store_status(status, i, err, 1); if (err) goto out_flush; @@ -1614,6 +1622,7 @@ static int do_pages_move(struct mm_struc err = do_move_pages_to_node(mm, &pagelist, current_node); if (err) goto out; + if (i > start) { err = store_status(status, start, current_node, i - start); if (err)