xref: /dflybsd-src/sys/dev/drm/include/linux/shrinker.h (revision 80fbca374953799e466257f34a6eef45dc0d369e)
1*80fbca37SFrançois Tigeot /*
2*80fbca37SFrançois Tigeot  * Copyright (c) 2019 François Tigeot <ftigeot@wolfpond.org>
3*80fbca37SFrançois Tigeot  * All rights reserved.
4*80fbca37SFrançois Tigeot  *
5*80fbca37SFrançois Tigeot  * Redistribution and use in source and binary forms, with or without
6*80fbca37SFrançois Tigeot  * modification, are permitted provided that the following conditions
7*80fbca37SFrançois Tigeot  * are met:
8*80fbca37SFrançois Tigeot  * 1. Redistributions of source code must retain the above copyright
9*80fbca37SFrançois Tigeot  *    notice unmodified, this list of conditions, and the following
10*80fbca37SFrançois Tigeot  *    disclaimer.
11*80fbca37SFrançois Tigeot  * 2. Redistributions in binary form must reproduce the above copyright
12*80fbca37SFrançois Tigeot  *    notice, this list of conditions and the following disclaimer in the
13*80fbca37SFrançois Tigeot  *    documentation and/or other materials provided with the distribution.
14*80fbca37SFrançois Tigeot  *
15*80fbca37SFrançois Tigeot  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16*80fbca37SFrançois Tigeot  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17*80fbca37SFrançois Tigeot  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18*80fbca37SFrançois Tigeot  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19*80fbca37SFrançois Tigeot  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20*80fbca37SFrançois Tigeot  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21*80fbca37SFrançois Tigeot  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22*80fbca37SFrançois Tigeot  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23*80fbca37SFrançois Tigeot  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24*80fbca37SFrançois Tigeot  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25*80fbca37SFrançois Tigeot  */
26*80fbca37SFrançois Tigeot 
27*80fbca37SFrançois Tigeot #ifndef _LINUX_SHRINKER_H_
28*80fbca37SFrançois Tigeot #define _LINUX_SHRINKER_H_
29*80fbca37SFrançois Tigeot 
30*80fbca37SFrançois Tigeot struct shrink_control {
31*80fbca37SFrançois Tigeot 	unsigned long nr_to_scan;
32*80fbca37SFrançois Tigeot };
33*80fbca37SFrançois Tigeot 
34*80fbca37SFrançois Tigeot struct shrinker {
35*80fbca37SFrançois Tigeot 	unsigned long (*count_objects)(struct shrinker *,
36*80fbca37SFrançois Tigeot 				       struct shrink_control *sc);
37*80fbca37SFrançois Tigeot 	unsigned long (*scan_objects)(struct shrinker *,
38*80fbca37SFrançois Tigeot 				      struct shrink_control *sc);
39*80fbca37SFrançois Tigeot 	int seeks;
40*80fbca37SFrançois Tigeot };
41*80fbca37SFrançois Tigeot 
42*80fbca37SFrançois Tigeot #define DEFAULT_SEEKS	2
43*80fbca37SFrançois Tigeot 
44*80fbca37SFrançois Tigeot #endif	/* _LINUX_SHRINKER_H_ */
45