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 5830BC43334 for ; Wed, 8 Jun 2022 04:38:41 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AA71F8D0001; Wed, 8 Jun 2022 00:38:40 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A55C86B0074; Wed, 8 Jun 2022 00:38:40 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8F6958D0001; Wed, 8 Jun 2022 00:38:40 -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 7F0E26B0072 for ; Wed, 8 Jun 2022 00:38:40 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 52F3C34F32 for ; Wed, 8 Jun 2022 04:38:40 +0000 (UTC) X-FDA: 79553812800.26.A77E9BA Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by imf04.hostedemail.com (Postfix) with ESMTP id C7ACB4004E for ; Wed, 8 Jun 2022 04:38:39 +0000 (UTC) Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 2583gIIT018059; Wed, 8 Jun 2022 04:38:12 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=message-id : date : mime-version : subject : to : cc : references : from : in-reply-to : content-type : content-transfer-encoding; s=pp1; bh=Lcpl/hu2wCLqkPkKh95mnc/bj3H++s7UjMpYnZ0eA2U=; b=jf5LTrJ1mWLlJvxXKUsot1rKHW/nB0mp3n2/q39azOjM2MUvlJBxxE/3UHo2ODOPTJ35 XB3uYRNyzacc3wkqmTbgSyvL+V9cCSB1aD9C7dta9D+rRKx/fVtQaFHShY3udos8ReTe laGoArfQQjwS62F0dQBzsM7/U/EFOVP1PgW1WYC/jjA4mcCPYiq4EmkeXWGN/pU9AxVI Smhq+aPSS22OZMbTKdM/1Qf3K7eCZ5wAW0ovN9n+vE4/izawUlf6aUBZ6pWIuDs3Mjln 9p8nu9ulx0mHPsIIsIaOE56FIzCPeYJiNikzwijfBk3o1RKjK3snax2ieNUEnuOS91jn mQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3gjm3c0v8j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 08 Jun 2022 04:38:11 +0000 Received: from m0098399.ppops.net (m0098399.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 2584NqwG002666; Wed, 8 Jun 2022 04:38:11 GMT Received: from ppma06ams.nl.ibm.com (66.31.33a9.ip4.static.sl-reverse.com [169.51.49.102]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3gjm3c0v7r-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 08 Jun 2022 04:38:10 +0000 Received: from pps.filterd (ppma06ams.nl.ibm.com [127.0.0.1]) by ppma06ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 2584LvpR016888; Wed, 8 Jun 2022 04:38:08 GMT Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by ppma06ams.nl.ibm.com with ESMTP id 3gfxnhvmn8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 08 Jun 2022 04:38:08 +0000 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 2584c6qI20447578 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 8 Jun 2022 04:38:06 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id EC0F152050; Wed, 8 Jun 2022 04:38:05 +0000 (GMT) Received: from [9.43.53.124] (unknown [9.43.53.124]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id 280105204E; Wed, 8 Jun 2022 04:37:58 +0000 (GMT) Message-ID: Date: Wed, 8 Jun 2022 10:07:57 +0530 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.10.0 Subject: Re: [PATCH v5 1/9] mm/demotion: Add support for explicit memory tiers Content-Language: en-US To: Tim Chen , linux-mm@kvack.org, akpm@linux-foundation.org Cc: Wei Xu , Huang Ying , Greg Thelen , Yang Shi , Davidlohr Bueso , Tim C Chen , Brice Goglin , Michal Hocko , Linux Kernel Mailing List , Hesham Almatary , Dave Hansen , Jonathan Cameron , Alistair Popple , Dan Williams , Feng Tang , Jagdish Gediya , Baolin Wang , David Rientjes References: <20220603134237.131362-1-aneesh.kumar@linux.ibm.com> <20220603134237.131362-2-aneesh.kumar@linux.ibm.com> <92649c9a6e0b6931b34aeaaf22c0a1e874484b7f.camel@linux.intel.com> From: Aneesh Kumar K V In-Reply-To: <92649c9a6e0b6931b34aeaaf22c0a1e874484b7f.camel@linux.intel.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: odQegtFdMQwT5etSdPBJ-IP0pQSGG7DP X-Proofpoint-GUID: uA45QuyrJme5pNVVqxOvY6jsTXknm344 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.874,Hydra:6.0.517,FMLib:17.11.64.514 definitions=2022-06-08_01,2022-06-07_02,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 mlxlogscore=999 spamscore=0 clxscore=1015 mlxscore=0 lowpriorityscore=0 phishscore=0 impostorscore=0 adultscore=0 priorityscore=1501 malwarescore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2204290000 definitions=main-2206080019 Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=jf5LTrJ1; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf04.hostedemail.com: domain of aneesh.kumar@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=aneesh.kumar@linux.ibm.com X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: C7ACB4004E X-Rspam-User: X-Stat-Signature: 9cmw5h38nkrt9a8gk9sqpjnbrjhhngcb X-HE-Tag: 1654663119-705145 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 6/8/22 12:13 AM, Tim Chen wrote: ... >> >> + >> +static void memory_tier_device_release(struct device *dev) >> +{ >> + struct memory_tier *tier = to_memory_tier(dev); >> + > > Do we need some ref counts on memory_tier? > If there is another device still using the same memtier, > free below could cause problem. > >> + kfree(tier); >> +} >> + >> > ... The lifecycle of the memory_tier struct is tied to the sysfs device life time. ie, memory_tier_device_relese get called only after the last reference on that sysfs dev object is released. Hence we can be sure there is no userspace that is keeping one of the memtier related sysfs file open. W.r.t other memory device sharing the same memtier, we unregister the sysfs device only when the memory tier nodelist is empty. That is no memory device is present in this memory tier. -aneesh