lkml.org 
[lkml]   [2022]   [Jun]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH v5 1/9] mm/demotion: Add support for explicit memory tiers
From
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

\
 
 \ /
  Last update: 2022-06-08 08:55    [W:0.140 / U:8.184 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site