xref: /dflybsd-src/sys/dev/drm/include/linux/shrinker.h (revision 1cfef1a587a371344cf93e80367482432b0933a2)
180fbca37SFrançois Tigeot /*
280fbca37SFrançois Tigeot  * Copyright (c) 2019 François Tigeot <ftigeot@wolfpond.org>
380fbca37SFrançois Tigeot  * All rights reserved.
480fbca37SFrançois Tigeot  *
580fbca37SFrançois Tigeot  * Redistribution and use in source and binary forms, with or without
680fbca37SFrançois Tigeot  * modification, are permitted provided that the following conditions
780fbca37SFrançois Tigeot  * are met:
880fbca37SFrançois Tigeot  * 1. Redistributions of source code must retain the above copyright
980fbca37SFrançois Tigeot  *    notice unmodified, this list of conditions, and the following
1080fbca37SFrançois Tigeot  *    disclaimer.
1180fbca37SFrançois Tigeot  * 2. Redistributions in binary form must reproduce the above copyright
1280fbca37SFrançois Tigeot  *    notice, this list of conditions and the following disclaimer in the
1380fbca37SFrançois Tigeot  *    documentation and/or other materials provided with the distribution.
1480fbca37SFrançois Tigeot  *
1580fbca37SFrançois Tigeot  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
1680fbca37SFrançois Tigeot  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
1780fbca37SFrançois Tigeot  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
1880fbca37SFrançois Tigeot  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
1980fbca37SFrançois Tigeot  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
2080fbca37SFrançois Tigeot  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2180fbca37SFrançois Tigeot  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2280fbca37SFrançois Tigeot  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2380fbca37SFrançois Tigeot  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
2480fbca37SFrançois Tigeot  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2580fbca37SFrançois Tigeot  */
2680fbca37SFrançois Tigeot 
2780fbca37SFrançois Tigeot #ifndef _LINUX_SHRINKER_H_
2880fbca37SFrançois Tigeot #define _LINUX_SHRINKER_H_
2980fbca37SFrançois Tigeot 
30*1cfef1a5SFrançois Tigeot #include <linux/types.h>
31*1cfef1a5SFrançois Tigeot 
3280fbca37SFrançois Tigeot struct shrink_control {
33*1cfef1a5SFrançois Tigeot 	gfp_t gfp_mask;
3480fbca37SFrançois Tigeot 	unsigned long nr_to_scan;
3580fbca37SFrançois Tigeot };
3680fbca37SFrançois Tigeot 
3780fbca37SFrançois Tigeot struct shrinker {
3880fbca37SFrançois Tigeot 	unsigned long (*count_objects)(struct shrinker *,
3980fbca37SFrançois Tigeot 				       struct shrink_control *sc);
4080fbca37SFrançois Tigeot 	unsigned long (*scan_objects)(struct shrinker *,
4180fbca37SFrançois Tigeot 				      struct shrink_control *sc);
4280fbca37SFrançois Tigeot 	int seeks;
4380fbca37SFrançois Tigeot };
4480fbca37SFrançois Tigeot 
4580fbca37SFrançois Tigeot #define DEFAULT_SEEKS	2
4680fbca37SFrançois Tigeot 
47*1cfef1a5SFrançois Tigeot #define SHRINK_STOP	(~0UL)
48*1cfef1a5SFrançois Tigeot 
4980fbca37SFrançois Tigeot #endif	/* _LINUX_SHRINKER_H_ */
50