diff options
| author | David S. Miller <davem@davemloft.net> | 2019-11-02 13:12:51 -0700 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2019-11-02 13:54:56 -0700 |
| commit | d31e95585ca697fb31440c6fe30113adc85ecfbd (patch) | |
| tree | 4936ea0aaa6b2aeeee4db51e3c60d938c9b9ed96 /include/linux/gfp.h | |
| parent | c23fcbbc6aa4e0bb615e8a7f23e1f32aec235a1c (diff) | |
| parent | 1204c70d9dcba31164f78ad5d8c88c42335d51f8 (diff) | |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
The only slightly tricky merge conflict was the netdevsim because the
mutex locking fix overlapped a lot of driver reload reorganization.
The rest were (relatively) trivial in nature.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/gfp.h')
| -rw-r--r-- | include/linux/gfp.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/include/linux/gfp.h b/include/linux/gfp.h index fb07b503dc45..61f2f6ff9467 100644 --- a/include/linux/gfp.h +++ b/include/linux/gfp.h @@ -325,6 +325,29 @@ static inline bool gfpflags_allow_blocking(const gfp_t gfp_flags) return !!(gfp_flags & __GFP_DIRECT_RECLAIM); } +/** + * gfpflags_normal_context - is gfp_flags a normal sleepable context? + * @gfp_flags: gfp_flags to test + * + * Test whether @gfp_flags indicates that the allocation is from the + * %current context and allowed to sleep. + * + * An allocation being allowed to block doesn't mean it owns the %current + * context. When direct reclaim path tries to allocate memory, the + * allocation context is nested inside whatever %current was doing at the + * time of the original allocation. The nested allocation may be allowed + * to block but modifying anything %current owns can corrupt the outer + * context's expectations. + * + * %true result from this function indicates that the allocation context + * can sleep and use anything that's associated with %current. + */ +static inline bool gfpflags_normal_context(const gfp_t gfp_flags) +{ + return (gfp_flags & (__GFP_DIRECT_RECLAIM | __GFP_MEMALLOC)) == + __GFP_DIRECT_RECLAIM; +} + #ifdef CONFIG_HIGHMEM #define OPT_ZONE_HIGHMEM ZONE_HIGHMEM #else |
