On Thu, 15 Jan 2026 13:56:42 +0000
Akash Goel <[email protected]> wrote:


> > +static unsigned long
> > +panthor_gem_shrinker_count(struct shrinker *shrinker, struct 
> > shrink_control *sc)
> > +{
> > +   struct panthor_device *ptdev = shrinker->private_data;
> > +   unsigned long count;
> > +
> > +   /* We currently don't have a flag to tell when the content of a
> > +    * BO can be discarded.
> > +    */
> > +   if (!can_swap())
> > +           return 0;
> > +
> > +   count = ptdev->reclaim.unused.count;
> > +   count += ptdev->reclaim.mmapped.count;
> > +
> > +   if (can_block(sc))
> > +           count += ptdev->reclaim.gpu_mapped_count;
> > +  
> 
> Should we do like this
> 
>       return count ? count : SHRINK_EMPTY;
> 
> 
> Other drivers are also doing the same
> 
> https://elixir.bootlin.com/linux/v6.18.4/source/drivers/gpu/drm/xe/xe_shrinker.c#L156
>  
> 
> 
> https://elixir.bootlin.com/linux/v6.18.4/source/drivers/gpu/drm/ttm/ttm_pool.c#L1160
> 
> https://elixir.bootlin.com/linux/v6.18.4/source/mm/vmalloc.c#L5245
> 
> It might matter if CONFIG_MEMCG is set.

Absolutely. I'll fix that in v2.

> 
> > +   return count;
> > +}

> >   /**
> > @@ -678,6 +689,16 @@ int panthor_vm_active(struct panthor_vm *vm)
> >     if (refcount_inc_not_zero(&vm->as.active_cnt))
> >             goto out_dev_exit;
> >   
> > +   /* As soon as active is called, we place the VM as the end of the VM 
> > LRU.  
> 
> 
> Please replace 'as the end' with 'at the end'.

Will do.

Reply via email to