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 16577C19F2C for ; Mon, 1 Aug 2022 07:13:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 635848E0002; Mon, 1 Aug 2022 03:13:15 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5E51D8E0001; Mon, 1 Aug 2022 03:13:15 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4AC418E0002; Mon, 1 Aug 2022 03:13:15 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 3AF0B8E0001 for ; Mon, 1 Aug 2022 03:13:15 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 11E4D1C60D2 for ; Mon, 1 Aug 2022 07:13:15 +0000 (UTC) X-FDA: 79750157550.05.61AE8B5 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by imf06.hostedemail.com (Postfix) with ESMTP id 68EFE1800DE for ; Mon, 1 Aug 2022 07:13:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1659337993; x=1690873993; h=from:to:cc:subject:references:date:in-reply-to: message-id:mime-version; bh=V0G6j28IaHxr9oC8YL9qnfip8DUfa6h6YBjToRwmjiE=; b=aEVkpDwBR+kLbakWoYyU5+YJz0Kwm3AhGCBCJrKmpo3IwcwJulgFO6SI RhvM7OITT38XQHcFvgtzAF8lIzA7hYDdLlmnM0nOS46Rm7pdvt4JOWmYK nGbEGvxyHakEceEm08yVF+lkFc6bBGgWh3VW+NdDuEfmon1p6VSmgMar1 gYnoWdiwwrnsO/y9gUGqT2LfhRrHITpMzWzxp+BVZIK6pis0cjuKDhohl nuESeJUEj4X5/dePNnOxKmy42LolEN5N2tZ0JzKnCHKSgJcOAM+enPzwD /2xsoq9JK7COm9M/iOE5F7d4PwJ8115qnxHA7I6OJjbo6M+5tWNT751De A==; X-IronPort-AV: E=McAfee;i="6400,9594,10425"; a="314902911" X-IronPort-AV: E=Sophos;i="5.93,206,1654585200"; d="scan'208";a="314902911" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Aug 2022 00:13:11 -0700 X-IronPort-AV: E=Sophos;i="5.93,206,1654585200"; d="scan'208";a="929447841" Received: from yhuang6-desk2.sh.intel.com (HELO yhuang6-desk2.ccr.corp.intel.com) ([10.238.208.55]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Aug 2022 00:13:08 -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 v11 4/8] mm/demotion/dax/kmem: Set node's abstract distance to MEMTIER_ADISTANCE_PMEM References: <20220728190436.858458-1-aneesh.kumar@linux.ibm.com> <20220728190436.858458-5-aneesh.kumar@linux.ibm.com> <875yjgmocg.fsf@yhuang6-desk2.ccr.corp.intel.com> <87bkt8s7w9.fsf@linux.ibm.com> <87k07slnt7.fsf@yhuang6-desk2.ccr.corp.intel.com> <87tu6wk0q5.fsf@yhuang6-desk2.ccr.corp.intel.com> <826fbdbc-219f-8f4a-7373-41c718287533@linux.ibm.com> <87les8jwpu.fsf@yhuang6-desk2.ccr.corp.intel.com> <1aba0c44-b096-8c75-8086-62d3cffc08b3@linux.ibm.com> Date: Mon, 01 Aug 2022 15:13:04 +0800 In-Reply-To: <1aba0c44-b096-8c75-8086-62d3cffc08b3@linux.ibm.com> (Aneesh Kumar K. V.'s message of "Mon, 1 Aug 2022 12:25:04 +0530") Message-ID: <87h72wjv27.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; imf06.hostedemail.com; dkim=none ("invalid DKIM record") header.d=intel.com header.s=Intel header.b=aEVkpDwB; spf=pass (imf06.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=1659337994; a=rsa-sha256; cv=none; b=5IzAWYtOmEsHaOnKffSIgPzPcX6IjpI2Hd9u0kSsHhLNmu15YtD8GKiPH7W8AVetteFwPM oqaqhgYzwDtB9lPCdS0esSJKx+OkQ7+T2/VkiDyP3Zeu6dP7mdpwdLztwWUQ7dRISiLrQA 73luEaTkEUeeGyTnAg6yLWeoA90n4/8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1659337994; 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=5qhDYYIkheeussxtggw3U/IlUWfFITOrDSfIrLRE6Jc=; b=Cf1sEuSiBZm+76Lp8EnKu4jju55xAkFMchVvajEIL3zDV4sxdrBDI5hiw5SVkGcGj7o4VB KLoVZyfKgS2an/1dd+dxUk6r1++QyNxMANZP6fo+2fyrKczwWyo81hGwpBUqVAf39bk3Nr e9MCkyzrLtFaG9M8hPhLvGpS0tN3G+Y= X-Stat-Signature: gtw95wqquzhtkhfpx44krjyy3bzfxr5s X-Rspamd-Queue-Id: 68EFE1800DE X-Rspam-User: X-Rspamd-Server: rspam05 Authentication-Results: imf06.hostedemail.com; dkim=none ("invalid DKIM record") header.d=intel.com header.s=Intel header.b=aEVkpDwB; spf=pass (imf06.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-HE-Tag: 1659337992-569376 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: > On 8/1/22 12:07 PM, Huang, Ying wrote: >> Aneesh Kumar K V writes: >> >>> On 8/1/22 10:40 AM, Huang, Ying wrote: >>>> Aneesh Kumar K V writes: >>>> >>>>> On 8/1/22 7:36 AM, Huang, Ying wrote: >>>>>> "Aneesh Kumar K.V" writes: >>>>>> >>>>>>> "Huang, Ying" writes: >>>>>>> >>>>>>>> "Aneesh Kumar K.V" writes: > > .... > >>>>> >>>>> With the module unload, it is kind of force removing the usage of the specific memtype. >>>>> Considering module unload will remove the usage of specific memtype from other parts >>>>> of the kernel and we already do all the required reset in memory hot unplug, do we >>>>> need to do the clear_node_memory_type above? >>>> >>>> Per my understanding, we need to call clear_node_memory_type() in >>>> dev_dax_kmem_remove(). After that, we have nothing to do in >>>> dax_kmem_exit(). >>>> >>> >>> Ok, I guess you are suggesting to do the clear_node_memory_type even if we fail the memory remove. >> >> Can we use node_memory_types[] to indicate whether a node is managed by >> a driver? >> >> Regardless being succeeded or failed, dev_dax_kmem_remove() will set >> node_memory_types[] = NULL. But until node is offlined, we will still >> keep the node in the memory_dev_type (dax_pmem_type). >> >> And we will prevent dax/kmem from unloading via try_module_get() and add >> "struct module *" to struct memory_dev_type. >> > > Current dax/kmem driver is not holding any module reference and allows the module to be unloaded > anytime. Even if the memory onlined by the driver fails to be unplugged. Addition of memory_dev_type > as suggested by you will be different than that. Page demotion can continue to work without the > support of dax_pmem_type as long as we keep the older demotion order. Any new demotion order > rebuild will remove the the memory node which was not hotunplugged from the demotion order. Isn't that > a much simpler implementation? Per my understanding, unbinding/binding the dax/kmem driver means changing the memory type of a memory device. For example, unbinding dax/kmem driver may mean changing the memory type from dax_pmem_type to default_memory_type (or default_dram_type). That appears strange. But if we force the NUMA node to be offlined for unbinding, we can avoid to change the memory type to default_memory_type. Best Regards, Huang, Ying