Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1395032ybt; Thu, 25 Jun 2020 05:11:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwKZkD1kvtN1G4ViWYeTRP2NX/QyV2kN5skIpE81oYPmpmzKzAHWGKPm66ElIlmvsl56I43 X-Received: by 2002:a05:6402:b26:: with SMTP id bo6mr1156150edb.185.1593087071636; Thu, 25 Jun 2020 05:11:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593087071; cv=none; d=google.com; s=arc-20160816; b=nKBaE1vTviusfH7PtvB8vMoFBgjJZQKbDO7Bs+2J7P7OPPDdL9pMmDZ9Pe5YzNnTB7 PU00p89POKw6Z18d9vkkVBBCcAAmg/RWQ2V2cm0hdRk57MiuSP9R5IEcNKokkQUYU2HD S4XTAtlfoia7IR1EpJ+vkJHrRzI96Jj1qBEQ1eDpF/b4/v94/LoJVsTIkRVDoi9Y0LAr 8pNx0noSJoz057G9V4VhN0OqH36gO00UcqXlwc4pJcVyspO6Tjl5YnhDjlLjRNtNCL/8 q7zhCdrJeHnR4EJ0l7tOoOf0RXOJU6HCOBZT0Z+W7E2uYkTLTBnQQltglGzXnGw1a4Xi RcGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=7ITcFTPhqH0yFOromZtekoS/tTUxNAq+U9QVX/lhl28=; b=psDXiggAN6Y/9fbvhJl7vaWg1c1fz0LLj/ifQcfTyKR9ONMAcRh+NUHQa7sFN0mnQc 7aUAYJKln6Hfj9a+gvXM+kU+kfwTDclOHhx3uycEOypb99VIntgox02R+xbBZMtIS72c +4YglRnrCvD0iQYOtqMFT1ICaXjcZrJUikCnp1osAJjFv5fkYA+6erzcY6EBn4/s++JB HZgwdWSAT3mkOgzMFGjAWOihzahf4XyMiQ3EtUYgxVEV9AxLlLULLcEHonDjEWCbehyp S8nHvRduPzuIoLIFdcgXEnqmSerMTL7NVdzVEYAoLeN4zPu7esc3W5wCdqTXWg0EIaRk fUsw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gt18si14577744ejb.467.2020.06.25.05.10.48; Thu, 25 Jun 2020 05:11:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404483AbgFYMJy (ORCPT + 99 others); Thu, 25 Jun 2020 08:09:54 -0400 Received: from mail-wm1-f65.google.com ([209.85.128.65]:55640 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404222AbgFYMJw (ORCPT ); Thu, 25 Jun 2020 08:09:52 -0400 Received: by mail-wm1-f65.google.com with SMTP id g75so5295366wme.5 for ; Thu, 25 Jun 2020 05:09:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=7ITcFTPhqH0yFOromZtekoS/tTUxNAq+U9QVX/lhl28=; b=IY5yAJMvqCCiYYl69gSMEWnxGA1ppm9tZtIQ0nY95v2PT14V4fuBXw5XFKgzBRImfu 3OJnEv58J4uiIPreYWc7cg0CJ3SaOLaugaRllDWeI8/laAL/GD2uFgwLSP3q+iwWSx3j NUEmFlqoWaW8B5RAyvl8Xz6tK/d2fmvJ3XBtv01XL45aff72CqX0aWVVPGI3G32qmZno JvNwaSleGJJuODwdsLKy+SGmJbpfr6jLWpc6FErVTzfLVi+bzF5BiuZElguhYg1J5+uF Qx+UftIllF0UAERuj06aWqU9XMkJxBgnU0qlq6bz5FWFOKYx+ufw73AU6kkjjBXMZvFJ 29eQ== X-Gm-Message-State: AOAM531qEzZJxUmkdlJQ+0ecKnTeXnA1Bur+JipCdUKH9/h5UZkPCyGP /xN1cuk+R/o6sPn99TVut8o= X-Received: by 2002:a05:600c:2058:: with SMTP id p24mr3029922wmg.74.1593086990388; Thu, 25 Jun 2020 05:09:50 -0700 (PDT) Received: from localhost (ip-37-188-168-3.eurotel.cz. [37.188.168.3]) by smtp.gmail.com with ESMTPSA id x18sm11707853wmi.35.2020.06.25.05.09.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Jun 2020 05:09:49 -0700 (PDT) Date: Thu, 25 Jun 2020 14:09:48 +0200 From: Michal Hocko To: js1304@gmail.com Cc: Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, kernel-team@lge.com, Vlastimil Babka , Christoph Hellwig , Roman Gushchin , Mike Kravetz , Naoya Horiguchi , Joonsoo Kim Subject: Re: [PATCH v3 7/8] mm/mempolicy: use a standard migration target allocation callback Message-ID: <20200625120948.GH1320@dhcp22.suse.cz> References: <1592892828-1934-1-git-send-email-iamjoonsoo.kim@lge.com> <1592892828-1934-8-git-send-email-iamjoonsoo.kim@lge.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1592892828-1934-8-git-send-email-iamjoonsoo.kim@lge.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue 23-06-20 15:13:47, Joonsoo Kim wrote: > From: Joonsoo Kim > > There is a well-defined migration target allocation callback. > Use it. > > Signed-off-by: Joonsoo Kim Acked-by: Michal Hocko > --- > mm/internal.h | 1 - > mm/mempolicy.c | 30 ++++++------------------------ > mm/migrate.c | 8 ++++++-- > 3 files changed, 12 insertions(+), 27 deletions(-) > > diff --git a/mm/internal.h b/mm/internal.h > index fb7f7fe..4f9f6b6 100644 > --- a/mm/internal.h > +++ b/mm/internal.h > @@ -613,7 +613,6 @@ static inline bool is_migrate_highatomic_page(struct page *page) > } > > void setup_zone_pageset(struct zone *zone); > -extern struct page *alloc_new_node_page(struct page *page, unsigned long node); > > struct migration_target_control { > int nid; /* preferred node id */ > diff --git a/mm/mempolicy.c b/mm/mempolicy.c > index a3abf64..85a3f21 100644 > --- a/mm/mempolicy.c > +++ b/mm/mempolicy.c > @@ -1065,28 +1065,6 @@ static int migrate_page_add(struct page *page, struct list_head *pagelist, > return 0; > } > > -/* page allocation callback for NUMA node migration */ > -struct page *alloc_new_node_page(struct page *page, unsigned long node) > -{ > - if (PageHuge(page)) { > - return alloc_huge_page_nodemask( > - page_hstate(compound_head(page)), node, > - NULL, __GFP_THISNODE, false); > - } else if (PageTransHuge(page)) { > - struct page *thp; > - > - thp = alloc_pages_node(node, > - (GFP_TRANSHUGE | __GFP_THISNODE), > - HPAGE_PMD_ORDER); > - if (!thp) > - return NULL; > - prep_transhuge_page(thp); > - return thp; > - } else > - return __alloc_pages_node(node, GFP_HIGHUSER_MOVABLE | > - __GFP_THISNODE, 0); > -} > - > /* > * Migrate pages from one node to a target node. > * Returns error or the number of pages not migrated. > @@ -1097,6 +1075,10 @@ static int migrate_to_node(struct mm_struct *mm, int source, int dest, > nodemask_t nmask; > LIST_HEAD(pagelist); > int err = 0; > + struct migration_target_control mtc = { > + .nid = dest, > + .gfp_mask = GFP_HIGHUSER_MOVABLE | __GFP_THISNODE, > + }; > > nodes_clear(nmask); > node_set(source, nmask); > @@ -1111,8 +1093,8 @@ static int migrate_to_node(struct mm_struct *mm, int source, int dest, > flags | MPOL_MF_DISCONTIG_OK, &pagelist); > > if (!list_empty(&pagelist)) { > - err = migrate_pages(&pagelist, alloc_new_node_page, NULL, dest, > - MIGRATE_SYNC, MR_SYSCALL); > + err = migrate_pages(&pagelist, alloc_migration_target, NULL, > + (unsigned long)&mtc, MIGRATE_SYNC, MR_SYSCALL); > if (err) > putback_movable_pages(&pagelist); > } > diff --git a/mm/migrate.c b/mm/migrate.c > index 7c4cd74..1c943b0 100644 > --- a/mm/migrate.c > +++ b/mm/migrate.c > @@ -1590,9 +1590,13 @@ static int do_move_pages_to_node(struct mm_struct *mm, > struct list_head *pagelist, int node) > { > int err; > + struct migration_target_control mtc = { > + .nid = node, > + .gfp_mask = GFP_HIGHUSER_MOVABLE | __GFP_THISNODE, > + }; > > - err = migrate_pages(pagelist, alloc_new_node_page, NULL, node, > - MIGRATE_SYNC, MR_SYSCALL); > + err = migrate_pages(pagelist, alloc_migration_target, NULL, > + (unsigned long)&mtc, MIGRATE_SYNC, MR_SYSCALL); > if (err) > putback_movable_pages(pagelist); > return err; > -- > 2.7.4 -- Michal Hocko SUSE Labs