[v10,3/4] mm: memory-failure: move memory_failure() return value documentation to function declaration
Commit Message
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
immediate access to function usage and return information.
Signed-off-by: Shuai Xue <xueshuai@linux.alibaba.com>
---
arch/x86/kernel/cpu/mce/core.c | 9 +--------
mm/memory-failure.c | 9 ++++++---
2 files changed, 7 insertions(+), 11 deletions(-)
Comments
On Mon, Dec 18, 2023 at 02:45:20PM +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
> immediate access to function usage and return information.
>
> Signed-off-by: Shuai Xue <xueshuai@linux.alibaba.com>
> ---
> arch/x86/kernel/cpu/mce/core.c | 9 +--------
> mm/memory-failure.c | 9 ++++++---
> 2 files changed, 7 insertions(+), 11 deletions(-)
>
<formletter>
This is not the correct way to submit patches for inclusion in the
stable kernel tree. Please read:
https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html
for how to do this properly.
</formletter>
@@ -1324,17 +1324,10 @@ 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;
- pr_err("Memory error not recovered");
+ pr_err("Sending SIGBUS to current task due to memory error not recovered");
kill_me_now(cb);
}
@@ -2164,9 +2164,12 @@ static int memory_failure_dev_pagemap(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 values:
+ * 0 - success
+ * -EOPNOTSUPP - hwpoison_filter() filtered the error event.
+ * -EHWPOISON - sent SIGBUS to the current process with the proper
+ * error info by kill_accessing_process().
+ * other negative values - failure
*/
int memory_failure(unsigned long pfn, int flags)
{