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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5CA68C433F5 for ; Wed, 11 May 2022 17:07:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D2E2C6B0073; Wed, 11 May 2022 13:07:18 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CDD886B0074; Wed, 11 May 2022 13:07:18 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B7FE96B0075; Wed, 11 May 2022 13:07:18 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id A1E976B0073 for ; Wed, 11 May 2022 13:07:18 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 6DFC92FF69 for ; Wed, 11 May 2022 17:07:18 +0000 (UTC) X-FDA: 79454092956.15.92A041C Received: from mail-vs1-f48.google.com (mail-vs1-f48.google.com [209.85.217.48]) by imf22.hostedemail.com (Postfix) with ESMTP id 1ADE0C00B2 for ; Wed, 11 May 2022 17:07:15 +0000 (UTC) Received: by mail-vs1-f48.google.com with SMTP id t85so2665553vst.4 for ; Wed, 11 May 2022 10:07:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=uPjT4Tguvue9a0veAerAix8NTcDtIksBUNaqTLtFpVY=; b=oxIxs731TckUq39OFqmh2ZtrR6f8sLVnMrH18gQRtD6lH2xniXwZqEBcvirowpPT7d a4x7dACQZsVurhabC77aNfJYHlYNWiwSdacEph6jwylnQ/D/zi0vu+ruzbjx1Fy3Ba8K PNccUNTcP/Dc6LLMaRs1Xq87UhYHnt7WjycpTHB8EECy1zTo1fTqvbCMGN/86vK7Ws0d QE3J+hwb9IszsXRf0INIKjPqY8PdPOSPSlffenAEgYETCUqlqjhJMLOOonyZNn2n3877 kqgrAn87aa0PkNl0o1pcUg86V7xx1LL1PUSYkWq9wKIBEAR7MWU1J02p4/OLmx2kngx/ 9yhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=uPjT4Tguvue9a0veAerAix8NTcDtIksBUNaqTLtFpVY=; b=vhiLDSFrhrgGjp3NJ3ZABUruLJ8lJ8YgPpk3aC/2pma5UoghANLDjK5uSWoDswLoG9 dFDkviKU1tVTJWukqzYECzckrUtT32F3LSiP+18BtGzXUuVl8e2TXxvsOnWbJk8Ef65l YbvuvOx7Uxiq83EdNAQUaZAgYfXfjMVGpqZDq1dN+MQmu9nHWJ7s5X4gVJIjL7iML6mV s3QLktlWamLE168tmPiNSHOw/GY76JBkQarvt6eGjngzn+4NhmSFwEPkKQG5SCyjSoZi Kqa+BJJnud6GII5VAMkhqCv/TOg5kWSeFY6bqeQe6gLprdapkAP3f8RMLydWoSFMNdh7 lxUw== X-Gm-Message-State: AOAM531J5X7vHNZLG8IlLye72C6kVK8F+NFm1Wky0KflRFtFVgykc9kG a/wZBbyM9UWrX7mSmQB/mKiyEAWz122HXoE7icCnUw== X-Google-Smtp-Source: ABdhPJw7/UQbmPRX/v1nQHdA2Ljp9qeqEevxnUd5JK3u+Rv8Kd8WJ8JVe2T3su6fZVja5UUUE8F4tLMIDm9wdTwYsMM= X-Received: by 2002:a05:6102:3ecf:b0:320:7c27:5539 with SMTP id n15-20020a0561023ecf00b003207c275539mr15026770vsv.59.1652288836875; Wed, 11 May 2022 10:07:16 -0700 (PDT) MIME-Version: 1.0 References: <87tua3h5r1.fsf@nvdebian.thelocal> <875ymerl81.fsf@nvdebian.thelocal> <87fslhhb2l.fsf@linux.ibm.com> <68333b21a58604f3fd0e660f1a39921ae22849d8.camel@intel.com> In-Reply-To: <68333b21a58604f3fd0e660f1a39921ae22849d8.camel@intel.com> From: Wei Xu Date: Wed, 11 May 2022 10:07:05 -0700 Message-ID: Subject: Re: RFC: Memory Tiering Kernel Interfaces To: "ying.huang@intel.com" Cc: "Aneesh Kumar K.V" , Alistair Popple , Yang Shi , Andrew Morton , Dave Hansen , Dan Williams , Linux MM , Greg Thelen , Jagdish Gediya , Linux Kernel Mailing List , Davidlohr Bueso , Michal Hocko , Baolin Wang , Brice Goglin , Feng Tang , Jonathan Cameron , Tim Chen Content-Type: text/plain; charset="UTF-8" Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=oxIxs731; spf=pass (imf22.hostedemail.com: domain of weixugc@google.com designates 209.85.217.48 as permitted sender) smtp.mailfrom=weixugc@google.com; dmarc=pass (policy=reject) header.from=google.com X-Rspam-User: X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 1ADE0C00B2 X-Stat-Signature: oyz94czsbgqosxauoit7tk18bi1znhjn X-HE-Tag: 1652288835-482371 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 Wed, May 11, 2022 at 12:49 AM ying.huang@intel.com wrote: > > On Tue, 2022-05-10 at 22:30 -0700, Wei Xu wrote: > > On Tue, May 10, 2022 at 4:38 AM Aneesh Kumar K.V > > wrote: > > > > > > Alistair Popple writes: > > > > > > > Wei Xu writes: > > > > > > > > > On Thu, May 5, 2022 at 5:19 PM Alistair Popple wrote: > > > > > > > > > > > > Wei Xu writes: > > > > > > > > > > > > [...] > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > Tiering Hierarchy Initialization > > > > > > > > > `==============================' > > > > > > > > > > > > > > > > > > By default, all memory nodes are in the top tier (N_TOPTIER_MEMORY). > > > > > > > > > > > > > > > > > > A device driver can remove its memory nodes from the top tier, e.g. > > > > > > > > > a dax driver can remove PMEM nodes from the top tier. > > > > > > > > > > > > > > > > With the topology built by firmware we should not need this. > > > > > > > > > > > > I agree that in an ideal world the hierarchy should be built by firmware based > > > > > > on something like the HMAT. But I also think being able to override this will be > > > > > > useful in getting there. Therefore a way of overriding the generated hierarchy > > > > > > would be good, either via sysfs or kernel boot parameter if we don't want to > > > > > > commit to a particular user interface now. > > > > > > > > > > > > However I'm less sure letting device-drivers override this is a good idea. How > > > > > > for example would a GPU driver make sure it's node is in the top tier? By moving > > > > > > every node that the driver does not know about out of N_TOPTIER_MEMORY? That > > > > > > could get messy if say there were two drivers both of which wanted their node to > > > > > > be in the top tier. > > > > > > > > > > The suggestion is to allow a device driver to opt out its memory > > > > > devices from the top-tier, not the other way around. > > > > > > > > So how would demotion work in the case of accelerators then? In that > > > > case we would want GPU memory to demote to DRAM, but that won't happen > > > > if both DRAM and GPU memory are in N_TOPTIER_MEMORY and it seems the > > > > only override available with this proposal would move GPU memory into a > > > > lower tier, which is the opposite of what's needed there. > > > > > > How about we do 3 tiers now. dax kmem devices can be registered to > > > tier 3. By default all numa nodes can be registered at tier 2 and HBM or > > > GPU can be enabled to register at tier 1. ? > > > > This makes sense. I will send an updated RFC based on the discussions so far. > > Are these tier number fixed? If so, it appears strange that the > smallest tier number is 0 on some machines, but 1 on some other > machines. When the kernel is configured to allow 3 tiers, we can always show all the 3 tiers. It is just that some tiers (e.g. tier 0) may be empty on some machines. BTW, the userspace should not assume a specific meaning of a particular tier id because it can change depending on the number of tiers that the kernel is configured with. For example, the userspace should not assume that tier-2 always means PMEM nodes. In a system with 4 tiers, PMEM nodes may be in tier-3, not tier-2. > Best Regards, > Huang, Ying > >