Skip to contentSkip to conversation

mm/doc: Fix fault_flag_allow_retry_first kerneldoc

PATCH Applied Matthew Wilcox (Oracle) 3 participants 9 messages Mar 22, 2021 – Mar 24, 2021

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/4 mm/doc: Fix fault_flag_allow_retry_first kerneldoc

make htmldocs reports:

./include/linux/mm.h:496: warning: Function parameter or member 'flags' not described in 'fault_flag_allow_retry_first'

Add a description.

---
 include/linux/mm.h | 1 +
 1 file changed, 1 insertion(+)
include/linux/mm.h +1 -0
index cb1e191da319..9c149e945bf9 100644
@@ -482,6 +482,7 @@ extern pgprot_t protection_map[16];
 
 /**
  * fault_flag_allow_retry_first - check ALLOW_RETRY the first time
+ * @flags: Fault flags.
  *
  * This is mostly used for places where we want to try to avoid taking
  * the mmap_lock for too long a time when waiting for another condition
Signature · 1 line
2.30.2
#1 lore raw

PATCH 2/4 mm/doc: Fix page_maybe_dma_pinned kerneldoc

make htmldocs reports:

./include/linux/mm.h:1341: warning: Excess function parameter 'Return' description in 'page_maybe_dma_pinned'

Fix a few other formatting nits while I'm editing this description.

---
 include/linux/mm.h | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
include/linux/mm.h +5 -5
index 9c149e945bf9..96e5ceffce09 100644
@@ -1273,10 +1273,11 @@ void unpin_user_page_range_dirty_lock(struct page *page, unsigned long npages,
 void unpin_user_pages(struct page **pages, unsigned long npages);
 
 /**
- * page_maybe_dma_pinned() - report if a page is pinned for DMA.
+ * page_maybe_dma_pinned - Report if a page is pinned for DMA.
+ * @page: The page.
  *
  * This function checks if a page has been pinned via a call to
- * pin_user_pages*().
+ * a function in the pin_user_pages() family.
  *
  * For non-huge pages, the return value is partially fuzzy: false is not fuzzy,
  * because it means "definitely not pinned for DMA", but true means "probably
@@ -1294,9 +1295,8 @@ void unpin_user_pages(struct page **pages, unsigned long npages);
  *
  * For more information, please see Documentation/core-api/pin_user_pages.rst.
  *
- * @page:	pointer to page to be queried.
- * @Return:	True, if it is likely that the page has been "dma-pinned".
- *		False, if the page is definitely not dma-pinned.
+ * Return: True, if it is likely that the page has been "dma-pinned".
+ * False, if the page is definitely not dma-pinned.
  */
 static inline bool page_maybe_dma_pinned(struct page *page)
 {
Signature · 1 line
2.30.2
Acked-by on v1 2/4
#2 lore raw

Re: [PATCH 2/4] mm/doc: Fix page_maybe_dma_pinned kerneldoc

Quoted 7 lines · Matthew Wilcox (Oracle)

make htmldocs reports:

./include/linux/mm.h:1341: warning: Excess function parameter 'Return' description in 'page_maybe_dma_pinned'

Fix a few other formatting nits while I'm editing this description.

Quoted 37 lines
---
 include/linux/mm.h | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
include/linux/mm.h +5 -5
index 9c149e945bf9..96e5ceffce09 100644
@@ -1273,10 +1273,11 @@ void unpin_user_page_range_dirty_lock(struct page *page, unsigned long npages,
 void unpin_user_pages(struct page **pages, unsigned long npages);
 
 /**
- * page_maybe_dma_pinned() - report if a page is pinned for DMA.
+ * page_maybe_dma_pinned - Report if a page is pinned for DMA.
+ * @page: The page.
  *
  * This function checks if a page has been pinned via a call to
- * pin_user_pages*().
+ * a function in the pin_user_pages() family.
  *
  * For non-huge pages, the return value is partially fuzzy: false is not fuzzy,
  * because it means "definitely not pinned for DMA", but true means "probably
@@ -1294,9 +1295,8 @@ void unpin_user_pages(struct page **pages, unsigned long npages);
  *
  * For more information, please see Documentation/core-api/pin_user_pages.rst.
  *
- * @page:	pointer to page to be queried.
- * @Return:	True, if it is likely that the page has been "dma-pinned".
- *		False, if the page is definitely not dma-pinned.
+ * Return: True, if it is likely that the page has been "dma-pinned".
+ * False, if the page is definitely not dma-pinned.
  */
 static inline bool page_maybe_dma_pinned(struct page *page)
 {
Signature · 1 line
2.30.2
Signature · 2 lines
Sincerely yours,
Mike.
Reviewed-by on v1 2/4
#3 lore raw

Re: [PATCH 2/4] mm/doc: Fix page_maybe_dma_pinned kerneldoc

In reply to Matthew Wilcox (Oracle)
Quoted 10 lines · Matthew Wilcox (Oracle)

make htmldocs reports:

./include/linux/mm.h:1341: warning: Excess function parameter 'Return' description in 'page_maybe_dma_pinned'

Fix a few other formatting nits while I'm editing this description.

---
  include/linux/mm.h | 10 +++++-----
  1 file changed, 5 insertions(+), 5 deletions(-)

Looks nice, thanks for fixing this up.

There was a slight delay, during which I re-learned that Sphinx 3 still causes a "nearly indefinite" delay in "make htmldocs". But eventually I got this to build and verified that the output made it through intact. I guess I'm grateful that Sphinx 3 works at all, though.

thanks,

Signature · 2 lines
John Hubbard
NVIDIA
Quoted 32 lines
include/linux/mm.h +5 -5
index 9c149e945bf9..96e5ceffce09 100644
@@ -1273,10 +1273,11 @@ void unpin_user_page_range_dirty_lock(struct page *page, unsigned long npages,
  void unpin_user_pages(struct page **pages, unsigned long npages);
 
  /**
- * page_maybe_dma_pinned() - report if a page is pinned for DMA.
+ * page_maybe_dma_pinned - Report if a page is pinned for DMA.
+ * @page: The page.
   *
   * This function checks if a page has been pinned via a call to
- * pin_user_pages*().
+ * a function in the pin_user_pages() family.
   *
   * For non-huge pages, the return value is partially fuzzy: false is not fuzzy,
   * because it means "definitely not pinned for DMA", but true means "probably
@@ -1294,9 +1295,8 @@ void unpin_user_pages(struct page **pages, unsigned long npages);
   *
   * For more information, please see Documentation/core-api/pin_user_pages.rst.
   *
- * @page:	pointer to page to be queried.
- * @Return:	True, if it is likely that the page has been "dma-pinned".
- *		False, if the page is definitely not dma-pinned.
+ * Return: True, if it is likely that the page has been "dma-pinned".
+ * False, if the page is definitely not dma-pinned.
   */
  static inline bool page_maybe_dma_pinned(struct page *page)
  {
#4 lore raw

PATCH 3/4 mm/doc: Turn fault flags into an enum

In reply to Matthew Wilcox (Oracle)

The kernel-doc script complains about ./include/linux/mm.h:425: warning: wrong kernel-doc identifier on line:
* Fault flag definitions.

I don't know how to document a series of #defines, so turn these definitions into an enum and document that instead.

---
 include/linux/mm.h | 29 +++++++++++++++--------------
 1 file changed, 15 insertions(+), 14 deletions(-)
include/linux/mm.h +15 -14
index 96e5ceffce09..58df4027dd4d 100644
@@ -429,8 +429,7 @@ extern unsigned int kobjsize(const void *objp);
 extern pgprot_t protection_map[16];
 
 /**
- * Fault flag definitions.
- *
+ * enum fault_flag - Fault flag definitions.
  * @FAULT_FLAG_WRITE: Fault was a write fault.
  * @FAULT_FLAG_MKWRITE: Fault was mkwrite of existing PTE.
  * @FAULT_FLAG_ALLOW_RETRY: Allow to retry the fault if blocked.
@@ -461,16 +460,18 @@ extern pgprot_t protection_map[16];
  * signals before a retry to make sure the continuous page faults can still be
  * interrupted if necessary.
  */
-#define FAULT_FLAG_WRITE			0x01
-#define FAULT_FLAG_MKWRITE			0x02
-#define FAULT_FLAG_ALLOW_RETRY			0x04
-#define FAULT_FLAG_RETRY_NOWAIT			0x08
-#define FAULT_FLAG_KILLABLE			0x10
-#define FAULT_FLAG_TRIED			0x20
-#define FAULT_FLAG_USER				0x40
-#define FAULT_FLAG_REMOTE			0x80
-#define FAULT_FLAG_INSTRUCTION  		0x100
-#define FAULT_FLAG_INTERRUPTIBLE		0x200
+enum fault_flag {
+	FAULT_FLAG_WRITE =		1 << 0,
+	FAULT_FLAG_MKWRITE =		1 << 1,
+	FAULT_FLAG_ALLOW_RETRY =	1 << 2,
+	FAULT_FLAG_RETRY_NOWAIT = 	1 << 3,
+	FAULT_FLAG_KILLABLE =		1 << 4,
+	FAULT_FLAG_TRIED = 		1 << 5,
+	FAULT_FLAG_USER =		1 << 6,
+	FAULT_FLAG_REMOTE =		1 << 7,
+	FAULT_FLAG_INSTRUCTION =	1 << 8,
+	FAULT_FLAG_INTERRUPTIBLE =	1 << 9,
+};
 
 /*
  * The default fault flags that should be used by most of the
@@ -493,7 +494,7 @@ extern pgprot_t protection_map[16];
  * Return: true if the page fault allows retry and this is the first
  * attempt of the fault handling; false otherwise.
  */
-static inline bool fault_flag_allow_retry_first(unsigned int flags)
+static inline bool fault_flag_allow_retry_first(enum fault_flag flags)
 {
 	return (flags & FAULT_FLAG_ALLOW_RETRY) &&
 	    (!(flags & FAULT_FLAG_TRIED));
@@ -528,7 +529,7 @@ struct vm_fault {
 		pgoff_t pgoff;			/* Logical page offset based on vma */
 		unsigned long address;		/* Faulting virtual address */
 	};
-	unsigned int flags;		/* FAULT_FLAG_xxx flags
+	enum fault_flag flags;		/* FAULT_FLAG_xxx flags
 					 * XXX: should really be 'const' */
 	pmd_t *pmd;			/* Pointer to pmd entry matching
 					 * the 'address' */
Signature · 1 line
2.30.2
Acked-by on v1 3/4
#5 lore raw

Re: [PATCH 3/4] mm/doc: Turn fault flags into an enum

Quoted 8 lines · Matthew Wilcox (Oracle)

The kernel-doc script complains about ./include/linux/mm.h:425: warning: wrong kernel-doc identifier on line:
* Fault flag definitions.

I don't know how to document a series of #defines, so turn these definitions into an enum and document that instead.

Quoted 68 lines
---
 include/linux/mm.h | 29 +++++++++++++++--------------
 1 file changed, 15 insertions(+), 14 deletions(-)
include/linux/mm.h +15 -14
index 96e5ceffce09..58df4027dd4d 100644
@@ -429,8 +429,7 @@ extern unsigned int kobjsize(const void *objp);
 extern pgprot_t protection_map[16];
 
 /**
- * Fault flag definitions.
- *
+ * enum fault_flag - Fault flag definitions.
  * @FAULT_FLAG_WRITE: Fault was a write fault.
  * @FAULT_FLAG_MKWRITE: Fault was mkwrite of existing PTE.
  * @FAULT_FLAG_ALLOW_RETRY: Allow to retry the fault if blocked.
@@ -461,16 +460,18 @@ extern pgprot_t protection_map[16];
  * signals before a retry to make sure the continuous page faults can still be
  * interrupted if necessary.
  */
-#define FAULT_FLAG_WRITE			0x01
-#define FAULT_FLAG_MKWRITE			0x02
-#define FAULT_FLAG_ALLOW_RETRY			0x04
-#define FAULT_FLAG_RETRY_NOWAIT			0x08
-#define FAULT_FLAG_KILLABLE			0x10
-#define FAULT_FLAG_TRIED			0x20
-#define FAULT_FLAG_USER				0x40
-#define FAULT_FLAG_REMOTE			0x80
-#define FAULT_FLAG_INSTRUCTION  		0x100
-#define FAULT_FLAG_INTERRUPTIBLE		0x200
+enum fault_flag {
+	FAULT_FLAG_WRITE =		1 << 0,
+	FAULT_FLAG_MKWRITE =		1 << 1,
+	FAULT_FLAG_ALLOW_RETRY =	1 << 2,
+	FAULT_FLAG_RETRY_NOWAIT = 	1 << 3,
+	FAULT_FLAG_KILLABLE =		1 << 4,
+	FAULT_FLAG_TRIED = 		1 << 5,
+	FAULT_FLAG_USER =		1 << 6,
+	FAULT_FLAG_REMOTE =		1 << 7,
+	FAULT_FLAG_INSTRUCTION =	1 << 8,
+	FAULT_FLAG_INTERRUPTIBLE =	1 << 9,
+};
 
 /*
  * The default fault flags that should be used by most of the
@@ -493,7 +494,7 @@ extern pgprot_t protection_map[16];
  * Return: true if the page fault allows retry and this is the first
  * attempt of the fault handling; false otherwise.
  */
-static inline bool fault_flag_allow_retry_first(unsigned int flags)
+static inline bool fault_flag_allow_retry_first(enum fault_flag flags)
 {
 	return (flags & FAULT_FLAG_ALLOW_RETRY) &&
 	    (!(flags & FAULT_FLAG_TRIED));
@@ -528,7 +529,7 @@ struct vm_fault {
 		pgoff_t pgoff;			/* Logical page offset based on vma */
 		unsigned long address;		/* Faulting virtual address */
 	};
-	unsigned int flags;		/* FAULT_FLAG_xxx flags
+	enum fault_flag flags;		/* FAULT_FLAG_xxx flags
 					 * XXX: should really be 'const' */
 	pmd_t *pmd;			/* Pointer to pmd entry matching
 					 * the 'address' */
Signature · 1 line
2.30.2
Signature · 2 lines
Sincerely yours,
Mike.
#6 lore raw

PATCH 4/4 mm/doc: Add mm.h and mm_types.h to the mm-api document

In reply to Matthew Wilcox (Oracle)

kerneldoc in include/linux/mm.h and include/linux/mm_types.h wasn't being included in the html build.

---
 Documentation/core-api/mm-api.rst | 4 ++++
 1 file changed, 4 insertions(+)
Documentation/core-api/mm-api.rst +4 -0
index 874ae1250258..34f46df91a8b 100644
@@ -93,3 +93,7 @@ More Memory Management Functions
 
 .. kernel-doc:: mm/page_alloc.c
 .. kernel-doc:: mm/mempolicy.c
+.. kernel-doc:: include/linux/mm_types.h
+   :internal:
+.. kernel-doc:: include/linux/mm.h
+   :internal:
Signature · 1 line
2.30.2
Acked-by on v1 4/4
#7 lore raw

Re: [PATCH 4/4] mm/doc: Add mm.h and mm_types.h to the mm-api document

Quoted 4 lines · Matthew Wilcox (Oracle)

kerneldoc in include/linux/mm.h and include/linux/mm_types.h wasn't being included in the html build.

Quoted 19 lines
---
 Documentation/core-api/mm-api.rst | 4 ++++
 1 file changed, 4 insertions(+)
Documentation/core-api/mm-api.rst +4 -0
index 874ae1250258..34f46df91a8b 100644
@@ -93,3 +93,7 @@ More Memory Management Functions
 
 .. kernel-doc:: mm/page_alloc.c
 .. kernel-doc:: mm/mempolicy.c
+.. kernel-doc:: include/linux/mm_types.h
+   :internal:
+.. kernel-doc:: include/linux/mm.h
+   :internal:
Signature · 1 line
2.30.2
Signature · 2 lines
Sincerely yours,
Mike.
Acked-by on v1 1/4
#8 lore raw
In reply to Matthew Wilcox (Oracle)
Quoted 7 lines · Matthew Wilcox (Oracle)

make htmldocs reports:

./include/linux/mm.h:496: warning: Function parameter or member 'flags' not described in 'fault_flag_allow_retry_first'

Add a description.

Quoted 19 lines
---
 include/linux/mm.h | 1 +
 1 file changed, 1 insertion(+)
include/linux/mm.h +1 -0
index cb1e191da319..9c149e945bf9 100644
@@ -482,6 +482,7 @@ extern pgprot_t protection_map[16];
 
 /**
  * fault_flag_allow_retry_first - check ALLOW_RETRY the first time
+ * @flags: Fault flags.
  *
  * This is mostly used for places where we want to try to avoid taking
  * the mmap_lock for too long a time when waiting for another condition
Signature · 1 line
2.30.2
Signature · 2 lines
Sincerely yours,
Mike.