From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7374BC433DB for ; Mon, 8 Mar 2021 23:59:10 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 0E1DD601FE for ; Mon, 8 Mar 2021 23:59:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0E1DD601FE Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 8D4748D008C; Mon, 8 Mar 2021 18:59:09 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 884038D007F; Mon, 8 Mar 2021 18:59:09 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6FDD98D008C; Mon, 8 Mar 2021 18:59:09 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0253.hostedemail.com [216.40.44.253]) by kanga.kvack.org (Postfix) with ESMTP id 51D188D007F for ; Mon, 8 Mar 2021 18:59:09 -0500 (EST) Received: from smtpin12.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 145972C88 for ; Mon, 8 Mar 2021 23:59:09 +0000 (UTC) X-FDA: 77898375618.12.402D414 Received: from mail-ej1-f48.google.com (mail-ej1-f48.google.com [209.85.218.48]) by imf04.hostedemail.com (Postfix) with ESMTP id D706B132 for ; Mon, 8 Mar 2021 23:59:07 +0000 (UTC) Received: by mail-ej1-f48.google.com with SMTP id p7so12510569eju.6 for ; Mon, 08 Mar 2021 15:59:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=S0sgCVzuEWKtYhGm2lK4XelzYXOqzpILEQnckI9FXEY=; b=Aseowwh2JcLWPQNWZOAXoWU0QMjWmb0VwfNqQlqr4N5u/ycJsRUTo9Z+R6wO5mxUJZ 2e1mPPdqAYjy5Cva32D8Rj5TmRWFs2+wwSX6N4WgdWNfwc6yidbnzv9+QmfbYxvL3eXA Hwcl8U+So2nBtK0xaGmGDyPrGmpQeuuAw2+g3Q/UAkmtMokQqRGoVRmrbXM3k5vPV119 0lzcB66ObWAzp54b6K9dLJ5y6ERIy496/BfljJFFgdjZKCWCOkOdhW5Iqr8CeaL4iy7c W+mc77qnThxN0+usIEXrLVY4EMv0p/RjSs2YnEmGO53QBFCottWEGA1aQtNik84ABfWZ lohw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=S0sgCVzuEWKtYhGm2lK4XelzYXOqzpILEQnckI9FXEY=; b=fEdtlTIimyVxXESUcKFeSpmM2Qpx9c3x+oobhDBSR59mBLmlP6cToOBC3ZI6T2cpl+ ydFNwDQt9mQ/oWcnnyNOU1oAINYXg1/+wjT+mK7T0DqkKtjHRyIBaHOCKnEwPuBjtUe1 O+R8ERuhfuzC1lBKxEw8+SkLZ0tLydXMkAQ5t9gXuTbwPj5tev30HK0SDLbn3InTfJaa n/JLmtf+T55mGbKFSxVacU+nCfPsTy6JBjyOoOtL6EBJpdJFbKs74cEmxYW1/4bWgV34 ycaw6BFEgKMabqMF3EbH5FWzJh+PUE5hq2bhJCDwYWgsIIyUHVF6zqaF6VHS7M40S3rc vKPQ== X-Gm-Message-State: AOAM530PSVvUi+pFpnht2qGBKeGNoHsRE+Dk/L9V5crgg055FU8F6Rny g9smO8ZsvVZUf7YXBZKqFLfcc3m1iDglA0X7AMA= X-Google-Smtp-Source: ABdhPJxjayvrTchiFV4M3OVjoplMke131OsV8QZAQ3K+FOsdbnZ4wotvDxsdIudVABZKs3qQy62KJhS5k94x51eZeMo= X-Received: by 2002:a17:906:a51:: with SMTP id x17mr17528122ejf.25.1615247947402; Mon, 08 Mar 2021 15:59:07 -0800 (PST) MIME-Version: 1.0 References: <20210304235949.7922C1C3@viggo.jf.intel.com> <20210304235951.271553C2@viggo.jf.intel.com> In-Reply-To: <20210304235951.271553C2@viggo.jf.intel.com> From: Yang Shi Date: Mon, 8 Mar 2021 15:58:56 -0800 Message-ID: Subject: Re: [PATCH 01/10] mm/numa: node demotion data structure and lookup To: Dave Hansen Cc: Linux Kernel Mailing List , Linux MM , Yang Shi , David Rientjes , Huang Ying , Dan Williams , David Hildenbrand , Oscar Salvador Content-Type: text/plain; charset="UTF-8" X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: D706B132 X-Stat-Signature: ig7iknuiyr6jdg4ubihcgqqyk6qqciea Received-SPF: none (gmail.com>: No applicable sender policy available) receiver=imf04; identity=mailfrom; envelope-from=""; helo=mail-ej1-f48.google.com; client-ip=209.85.218.48 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1615247947-909006 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Thu, Mar 4, 2021 at 4:00 PM Dave Hansen wrote: > > > From: Dave Hansen > > Prepare for the kernel to auto-migrate pages to other memory nodes > with a user defined node migration table. This allows creating single > migration target for each NUMA node to enable the kernel to do NUMA > page migrations instead of simply reclaiming colder pages. A node > with no target is a "terminal node", so reclaim acts normally there. > The migration target does not fundamentally _need_ to be a single node, > but this implementation starts there to limit complexity. > > If you consider the migration path as a graph, cycles (loops) in the > graph are disallowed. This avoids wasting resources by constantly > migrating (A->B, B->A, A->B ...). The expectation is that cycles will > never be allowed. Reviewed-by: Yang Shi > > Signed-off-by: Dave Hansen > Cc: Yang Shi > Cc: David Rientjes > Cc: Huang Ying > Cc: Dan Williams > Cc: David Hildenbrand > Cc: osalvador > > -- > > changes since 20200122: > * Make node_demotion[] __read_mostly > > changes in July 2020: > - Remove loop from next_demotion_node() and get_online_mems(). > This means that the node returned by next_demotion_node() > might now be offline, but the worst case is that the > allocation fails. That's fine since it is transient. > --- > > b/mm/migrate.c | 17 +++++++++++++++++ > 1 file changed, 17 insertions(+) > > diff -puN mm/migrate.c~0006-node-Define-and-export-memory-migration-path mm/migrate.c > --- a/mm/migrate.c~0006-node-Define-and-export-memory-migration-path 2021-03-04 15:35:51.353806441 -0800 > +++ b/mm/migrate.c 2021-03-04 15:35:51.359806441 -0800 > @@ -1157,6 +1157,23 @@ out: > return rc; > } > > +static int node_demotion[MAX_NUMNODES] __read_mostly = > + {[0 ... MAX_NUMNODES - 1] = NUMA_NO_NODE}; > + > +/** > + * next_demotion_node() - Get the next node in the demotion path > + * @node: The starting node to lookup the next node > + * > + * @returns: node id for next memory node in the demotion path hierarchy > + * from @node; NUMA_NO_NODE if @node is terminal. This does not keep > + * @node online or guarantee that it *continues* to be the next demotion > + * target. > + */ > +int next_demotion_node(int node) > +{ > + return node_demotion[node]; > +} > + > /* > * Obtain the lock on page, remove all ptes and migrate the page > * to the newly allocated page in newpage. > _ >