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 CC334C00144 for ; Thu, 4 Aug 2022 04:20:03 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id F2CDC8E0002; Thu, 4 Aug 2022 00:20:02 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EE9978E0001; Thu, 4 Aug 2022 00:20:02 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DA4398E0002; Thu, 4 Aug 2022 00:20:02 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id C77538E0001 for ; Thu, 4 Aug 2022 00:20:02 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 9199EC06E6 for ; Thu, 4 Aug 2022 04:20:02 +0000 (UTC) X-FDA: 79760607444.03.D61CF4F Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by imf08.hostedemail.com (Postfix) with ESMTP id 6E87E160030 for ; Thu, 4 Aug 2022 04:20:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1659586801; x=1691122801; h=from:to:cc:subject:references:date:in-reply-to: message-id:mime-version; bh=KHVAisvlsLMn2oCveG7/DD5TwcCi7B3kpKuDrB4r4NI=; b=YZE1AGcuWc63g8UT8WWRGJ4+NO4uhyVkplBlgTbHC+2VcAOqFZDqIrnl 4fXTVbN0Xf/zDd6GAyz6SjezBR9wfqruIJbxLhLOVNJ6lbqdPUl5gU5Iv BG1nvrkEBgL49L0qfLL2b2uxU9gmzNQNDMStX1vo/l/IL35uICO45L0Cc 9R5syuCZEn0ttVqa3cEuO2OkZZJFZa5wIOpeJU6BD97UjWdreMKvFl3Ao AJodTeuzH75tlELHZQhMVBOLw+tryG/nfOu4p6VQshgYRkZmJlcBdLW4W bBIebAh/mUkBzptJADJ0oPOoWtfVNt2aRS0svhB9AkUlu1/XqWOR85Eud A==; X-IronPort-AV: E=McAfee;i="6400,9594,10428"; a="315706786" X-IronPort-AV: E=Sophos;i="5.93,214,1654585200"; d="scan'208";a="315706786" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Aug 2022 21:19:51 -0700 X-IronPort-AV: E=Sophos;i="5.93,214,1654585200"; d="scan'208";a="578911559" Received: from yhuang6-desk2.sh.intel.com (HELO yhuang6-desk2.ccr.corp.intel.com) ([10.238.208.55]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Aug 2022 21:19:47 -0700 From: "Huang, Ying" To: "Aneesh Kumar K.V" Cc: linux-mm@kvack.org, akpm@linux-foundation.org, Wei Xu , Yang Shi , Davidlohr Bueso , Tim C Chen , Michal Hocko , Linux Kernel Mailing List , Hesham Almatary , Dave Hansen , Jonathan Cameron , Alistair Popple , Dan Williams , Johannes Weiner , jvgediya.oss@gmail.com Subject: Re: [PATCH v10 5/8] mm/demotion: Build demotion targets based on explicit memory tiers References: <20220720025920.1373558-1-aneesh.kumar@linux.ibm.com> <20220720025920.1373558-6-aneesh.kumar@linux.ibm.com> <871qu8wc6c.fsf@yhuang6-desk2.ccr.corp.intel.com> <9f14814c-cb08-8032-caff-edcd0594ad41@linux.ibm.com> <87h733uyc8.fsf@yhuang6-desk2.ccr.corp.intel.com> <878ro6rp50.fsf@linux.ibm.com> Date: Thu, 04 Aug 2022 12:19:32 +0800 In-Reply-To: <878ro6rp50.fsf@linux.ibm.com> (Aneesh Kumar K. V.'s message of "Wed, 03 Aug 2022 08:48:19 +0530") Message-ID: <87mtckiqsr.fsf@yhuang6-desk2.ccr.corp.intel.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=ascii ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=none ("invalid DKIM record") header.d=intel.com header.s=Intel header.b=YZE1AGcu; spf=pass (imf08.hostedemail.com: domain of ying.huang@intel.com designates 192.55.52.88 as permitted sender) smtp.mailfrom=ying.huang@intel.com; dmarc=pass (policy=none) header.from=intel.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1659586802; a=rsa-sha256; cv=none; b=lMMMr1zjhCz8MxDamMeopB2pLx/j4afz23cgQl0erIsgTwq3+jx12vf+pZIVRoCpIh9mwx PDgQaK6TZS7H2x8PyrSFqARWic+VksQ0G2vTASbn4efaClwS7iF3HLsHF3rcGhr2jB1uXh y49RTFIH6ctlYv6PJg64ifFQDV9AtXU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1659586802; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=Wj+9BLROffiQ+u0aX7inuyfSGlRGNnQzKNrRwEK8Y0I=; b=Wr19zJhARGfbcbwXKR+YFIq0JB25qugptydk5ZH0UNH5Cy6zDyfbOUFMaMGfCttYk4DUJf KX0vOJ8Wxut70vpwOsGKAdvcwn/VvjRvQfuMYzNGlVjCWZjAuhmBLNGP9D0KTOrKHdplPH R5ESU+sICprQqjds/L3zX+51s5x57oI= X-Stat-Signature: o3uztnput9n9ktgtosi5ae3ozqe16rtr X-Rspamd-Queue-Id: 6E87E160030 Authentication-Results: imf08.hostedemail.com; dkim=none ("invalid DKIM record") header.d=intel.com header.s=Intel header.b=YZE1AGcu; spf=pass (imf08.hostedemail.com: domain of ying.huang@intel.com designates 192.55.52.88 as permitted sender) smtp.mailfrom=ying.huang@intel.com; dmarc=pass (policy=none) header.from=intel.com X-Rspam-User: X-Rspamd-Server: rspam12 X-HE-Tag: 1659586801-366863 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: "Aneesh Kumar K.V" writes: > "Huang, Ying" writes: > >> Aneesh Kumar K V writes: >> >>> On 7/26/22 1:14 PM, Huang, Ying wrote: >>>> "Aneesh Kumar K.V" writes: > > .... > >>>> + >>>>> static void init_node_memory_tier(int node) >>>>> { >>>>> int perf_level; >>>>> @@ -84,11 +285,19 @@ static void init_node_memory_tier(int node) >>>>> mutex_lock(&memory_tier_lock); >>>>> >>>>> memtier = __node_get_memory_tier(node); >>>>> + /* >>>>> + * if node is already part of the tier proceed with the >>>>> + * current tier value, because we might want to establish >>>>> + * new migration paths now. The node might be added to a tier >>>>> + * before it was made part of N_MEMORY, hence estabilish_migration_targets >>>>> + * will have skipped this node. >>>>> + */ >>>>> if (!memtier) { >>>>> perf_level = node_devices[node]->perf_level; >>>>> memtier = find_create_memory_tier(perf_level); >>>>> node_set(node, memtier->nodelist); >>>>> } >>>>> + establish_migration_targets(); >>>> >>>> Why combines memory tiers establishing with demotion targets building? >>>> I think that it's better to separate them. For example, if we move a >>>> set of NUMA node from one memory tier to another memory tier, we only >>>> need to run establish_migration_targets() once after moving all nodes. >>>> >>> >>> Yes agree. I am not sure I followed your comment here. >>> >>> Demotion target rebuilding is a separate helper. Any update to memory tiers needs rebuilding >>> of demotion targets. Also any change in node mask of memory tier needs >>> demotion target rebuild. Can you clarify the code change you are suggesting here? >> >> I think we should call establish_migration_targets() in >> migrate_on_reclaim_callback() directly. As the example I mentioned >> above, sometimes, we don't need to call establish_migration_targets() >> for each node changing. >> > > We need to hold memory_tier_lock while updating node's memory tier and > rebuilding demotion targets. All of that is done in the same function > here. An update node memory tier that allow for updating multiple node's > memory tier together would do what you mentioned above under > memory_tier_lock ie, update all the nodes memory tier and then call > establish_migration_targets() once. I don't think it's good to duplicate code unnecessarily. Managing memory tiers and estabilishing demotion target are two separate stuff. We shouldn't combined them. If memory_tier_lock needs to be held, just enclosing estabilish_migration_targets() with it. Best Regards, Huang, Ying