mm/gfp: add kernel-doc for gfp_t

The generated html will link to the definition of the gfp_t automatically
once we define it.  Move the one-paragraph overview of GFP flags from the
documentation directory into gfp.h and pull gfp.h into the documentation.

This generates warnings with clang
(https://lkml.kernel.org/r/20210219195509.GA59987@24bbad8f3778), so
use a #if 0 to hide it from the compiler for now.

Link: https://lkml.kernel.org/r/20210215204909.3824509-1-willy@infradead.org
Link: https://lkml.kernel.org/r/20210220003049.GZ2858050@casper.infradead.org
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Acked-by: Mike Rapoport <rppt@linux.ibm.com>
Cc: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Matthew Wilcox (Oracle)
2021-02-24 12:06:35 -08:00
committed by Linus Torvalds
parent a0cd7a7c4b
commit 3b2ebeaf98
2 changed files with 16 additions and 5 deletions

View File

@@ -19,11 +19,8 @@ User Space Memory Access
Memory Allocation Controls Memory Allocation Controls
========================== ==========================
Functions which need to allocate memory often use GFP flags to express .. kernel-doc:: include/linux/gfp.h
how that memory should be allocated. The GFP acronym stands for "get :internal:
free pages", the underlying memory allocation function. Not every GFP
flag is allowed to every function which may allocate memory. Most
users will want to use a plain ``GFP_KERNEL``.
.. kernel-doc:: include/linux/gfp.h .. kernel-doc:: include/linux/gfp.h
:doc: Page mobility and placement hints :doc: Page mobility and placement hints

View File

@@ -8,6 +8,20 @@
#include <linux/linkage.h> #include <linux/linkage.h>
#include <linux/topology.h> #include <linux/topology.h>
/* The typedef is in types.h but we want the documentation here */
#if 0
/**
* typedef gfp_t - Memory allocation flags.
*
* GFP flags are commonly used throughout Linux to indicate how memory
* should be allocated. The GFP acronym stands for get_free_pages(),
* the underlying memory allocation function. Not every GFP flag is
* supported by every function which may allocate memory. Most users
* will want to use a plain ``GFP_KERNEL``.
*/
typedef unsigned int __bitwise gfp_t;
#endif
struct vm_area_struct; struct vm_area_struct;
/* /*