lkml.org 
[lkml]   [2022]   [Jun]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH v6 17/22] drm/shmem-helper: Add generic memory shrinker
From
20.06.2022 18:37, Rob Clark пишет:
>> +static unsigned long
>> +drm_gem_shmem_shrinker_scan_objects(struct shrinker *shrinker,
>> + struct shrink_control *sc)
>> +{
>> + unsigned long nr_to_scan = sc->nr_to_scan;
>> + bool lock_contention = false;
>> + unsigned long freed;
>> +
>> + /* purge as many objects as we can */
>> + freed = drm_gem_shmem_shrinker_run_objects_scan(shrinker, nr_to_scan,
>> + &lock_contention, false);
>> +
>> + /* evict as many objects as we can */
>> + if (freed < nr_to_scan)
> oh, one other small note, both in scan_objects() and count_objects(),
> you should check that get_nr_swap_pages()>0 before counting
> evictable/willneed objects. (And you probably want to keep separate
> LRUs for dontneed vs willneed to accomplish that.) At least for CrOS,
> inside the VM there is no swap enabled (but instead we rely on zram
> swap in the host.. plus vm-balloon to balance memory pressure between
> host and guest)

Noted, thank you!

\
 
 \ /
  Last update: 2022-06-21 18:40    [W:0.162 / U:2.372 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site