lkml.org 
[lkml]   [2018]   [Aug]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] mm: Use special value SHRINKER_REGISTERING instead list_empty() check
On Sat, Aug 04, 2018 at 09:42:05PM +0300, Kirill Tkhai wrote:
> This is exactly the thing the patch makes. Instead of inserting a shrinker pointer
> to idr, it inserts a fake value SHRINKER_REGISTERING there. The patch makes impossible
> to dereference a shrinker unless it's completely registered.

- id = idr_alloc(&shrinker_idr, shrinker, 0, 0, GFP_KERNEL);
+ id = idr_alloc(&shrinker_idr, SHRINKER_REGISTERING, 0, 0, GFP_KERNEL);

Instead:

+ id = idr_alloc(&shrinker_idr, NULL, 0, 0, GFP_KERNEL);

... and the rest of your patch becomes even simpler.

\
 
 \ /
  Last update: 2018-08-05 02:03    [W:0.155 / U:0.596 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site