lkml.org 
[lkml]   [2020]   [Nov]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 2/3] mm: Extract might_alloc() debug check
From
Date
Hi,

On 11/20/20 1:54 AM, Daniel Vetter wrote:
> diff --git a/include/linux/sched/mm.h b/include/linux/sched/mm.h
> index d5ece7a9a403..f94405d43fd1 100644
> --- a/include/linux/sched/mm.h
> +++ b/include/linux/sched/mm.h
> @@ -180,6 +180,22 @@ static inline void fs_reclaim_acquire(gfp_t gfp_mask) { }
> static inline void fs_reclaim_release(gfp_t gfp_mask) { }
> #endif
>
> +/**
> + * might_alloc - Marks possible allocation sites

Mark

> + * @gfp_mask: gfp_t flags that would be use to allocate

used

> + *
> + * Similar to might_sleep() and other annotations this can be used in functions

annotations,

> + * that might allocate, but often dont. Compiles to nothing without

don't.

> + * CONFIG_LOCKDEP. Includes a conditional might_sleep() if @gfp allows blocking.

? might_sleep_if() if

> + */
> +static inline void might_alloc(gfp_t gfp_mask)
> +{
> + fs_reclaim_acquire(gfp_mask);
> + fs_reclaim_release(gfp_mask);
> +
> + might_sleep_if(gfpflags_allow_blocking(gfp_mask));
> +}


--
~Randy

\
 
 \ /
  Last update: 2020-11-20 18:21    [W:0.129 / U:0.252 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site