Re: [PATCH v18 2/3] mm: memory-failure: move return value documentation to function declaration

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





在 2025/2/27 20:31, Catalin Marinas 写道:
(going through patches in my inbox)

On Tue, Jan 07, 2025 at 04:17:34PM +0800, Shuai Xue wrote:
Part of return value comments for memory_failure() were originally
documented at the call site. Move those comments to the function
declaration to improve code readability and to provide developers with

s/declaration/definition/

Thanks, will fix.


immediate access to function usage and return information.

Signed-off-by: Shuai Xue <xueshuai@xxxxxxxxxxxxxxxxx>
Reviewed-by: Jarkko Sakkinen <jarkko@xxxxxxxxxx>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx>
Reviewed-by: Yazen Ghannam <yazen.ghannam@xxxxxxx>
Reviewed-by: Jane Chu <jane.chu@xxxxxxxxxx>
---
  arch/x86/kernel/cpu/mce/core.c |  7 -------
  mm/memory-failure.c            | 10 +++++++---
  2 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/arch/x86/kernel/cpu/mce/core.c b/arch/x86/kernel/cpu/mce/core.c
index 7fb5556a0b53..d1dd7f892514 100644
--- a/arch/x86/kernel/cpu/mce/core.c
+++ b/arch/x86/kernel/cpu/mce/core.c
@@ -1398,13 +1398,6 @@ static void kill_me_maybe(struct callback_head *cb)
  		return;
  	}
- /*
-	 * -EHWPOISON from memory_failure() means that it already sent SIGBUS
-	 * to the current process with the proper error info,
-	 * -EOPNOTSUPP means hwpoison_filter() filtered the error event,
-	 *
-	 * In both cases, no further processing is required.
-	 */
  	if (ret == -EHWPOISON || ret == -EOPNOTSUPP)
  		return;
diff --git a/mm/memory-failure.c b/mm/memory-failure.c
index a7b8ccd29b6f..14c316d7d38d 100644
--- a/mm/memory-failure.c
+++ b/mm/memory-failure.c
@@ -2211,9 +2211,13 @@ static void kill_procs_now(struct page *p, unsigned long pfn, int flags,
   * Must run in process context (e.g. a work queue) with interrupts
   * enabled and no spinlocks held.
   *
- * Return: 0 for successfully handled the memory error,
- *         -EOPNOTSUPP for hwpoison_filter() filtered the error event,
- *         < 0(except -EOPNOTSUPP) on failure.
+ * Return:
+ *   0             - success,
+ *   -ENXIO        - memory not managed by the kernel
+ *   -EOPNOTSUPP   - hwpoison_filter() filtered the error event,
+ *   -EHWPOISON    - the page was already poisoned, potentially
+ *                   kill process,
+ *   other negative values - failure.
   */
  int memory_failure(unsigned long pfn, int flags)
  {

Why not keep the comment in both places? One is about the x86 decisions,
the other is about what memory_failure() can return.


Ok, will keep x86 path.

By the way, could arm maintainers help to ack patch 1 and 3 if there
is no objection?

Thanks.
Shuai





[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]
  Powered by Linux