diff options
Diffstat (limited to 'include/linux/shrinker.h')
| -rw-r--r-- | include/linux/shrinker.h | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/include/linux/shrinker.h b/include/linux/shrinker.h index 6794490f25b2..9443cafd1969 100644 --- a/include/linux/shrinker.h +++ b/include/linux/shrinker.h | |||
| @@ -12,6 +12,9 @@ | |||
| 12 | struct shrink_control { | 12 | struct shrink_control { |
| 13 | gfp_t gfp_mask; | 13 | gfp_t gfp_mask; |
| 14 | 14 | ||
| 15 | /* current node being shrunk (for NUMA aware shrinkers) */ | ||
| 16 | int nid; | ||
| 17 | |||
| 15 | /* | 18 | /* |
| 16 | * How many objects scan_objects should scan and try to reclaim. | 19 | * How many objects scan_objects should scan and try to reclaim. |
| 17 | * This is reset before every call, so it is safe for callees | 20 | * This is reset before every call, so it is safe for callees |
| @@ -26,20 +29,20 @@ struct shrink_control { | |||
| 26 | */ | 29 | */ |
| 27 | unsigned long nr_scanned; | 30 | unsigned long nr_scanned; |
| 28 | 31 | ||
| 29 | /* current node being shrunk (for NUMA aware shrinkers) */ | ||
| 30 | int nid; | ||
| 31 | |||
| 32 | /* current memcg being shrunk (for memcg aware shrinkers) */ | 32 | /* current memcg being shrunk (for memcg aware shrinkers) */ |
| 33 | struct mem_cgroup *memcg; | 33 | struct mem_cgroup *memcg; |
| 34 | }; | 34 | }; |
| 35 | 35 | ||
| 36 | #define SHRINK_STOP (~0UL) | 36 | #define SHRINK_STOP (~0UL) |
| 37 | #define SHRINK_EMPTY (~0UL - 1) | ||
| 37 | /* | 38 | /* |
| 38 | * A callback you can register to apply pressure to ageable caches. | 39 | * A callback you can register to apply pressure to ageable caches. |
| 39 | * | 40 | * |
| 40 | * @count_objects should return the number of freeable items in the cache. If | 41 | * @count_objects should return the number of freeable items in the cache. If |
| 41 | * there are no objects to free or the number of freeable items cannot be | 42 | * there are no objects to free, it should return SHRINK_EMPTY, while 0 is |
| 42 | * determined, it should return 0. No deadlock checks should be done during the | 43 | * returned in cases of the number of freeable items cannot be determined |
| 44 | * or shrinker should skip this cache for this time (e.g., their number | ||
| 45 | * is below shrinkable limit). No deadlock checks should be done during the | ||
| 43 | * count callback - the shrinker relies on aggregating scan counts that couldn't | 46 | * count callback - the shrinker relies on aggregating scan counts that couldn't |
| 44 | * be executed due to potential deadlocks to be run at a later call when the | 47 | * be executed due to potential deadlocks to be run at a later call when the |
| 45 | * deadlock condition is no longer pending. | 48 | * deadlock condition is no longer pending. |
| @@ -60,12 +63,16 @@ struct shrinker { | |||
| 60 | unsigned long (*scan_objects)(struct shrinker *, | 63 | unsigned long (*scan_objects)(struct shrinker *, |
| 61 | struct shrink_control *sc); | 64 | struct shrink_control *sc); |
| 62 | 65 | ||
| 63 | int seeks; /* seeks to recreate an obj */ | ||
| 64 | long batch; /* reclaim batch size, 0 = default */ | 66 | long batch; /* reclaim batch size, 0 = default */ |
| 65 | unsigned long flags; | 67 | int seeks; /* seeks to recreate an obj */ |
| 68 | unsigned flags; | ||
| 66 | 69 | ||
| 67 | /* These are for internal use */ | 70 | /* These are for internal use */ |
| 68 | struct list_head list; | 71 | struct list_head list; |
| 72 | #ifdef CONFIG_MEMCG_KMEM | ||
| 73 | /* ID in shrinker_idr */ | ||
| 74 | int id; | ||
| 75 | #endif | ||
| 69 | /* objs pending delete, per node */ | 76 | /* objs pending delete, per node */ |
| 70 | atomic_long_t *nr_deferred; | 77 | atomic_long_t *nr_deferred; |
| 71 | }; | 78 | }; |
