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