Re: [PATCH] mm: madvise: add description for MADV_WIPEONFORK and MADV_KEEPONFORK

2017-09-22 Thread Rik van Riel
On Sat, 2017-09-23 at 05:55 +0800, Yang Shi wrote:
> mm/madvise.c has the brief description about all MADV_ flags, added
> the
> description for the newly added MADV_WIPEONFORK and MADV_KEEPONFORK.
> 
> Although man page has the similar information, but it'd better to
> keep the
> consistency with other flags.
> 
> Signed-off-by: Yang Shi 
> 
Thank you for spotting that I missed a location!

Reviewed-by: Rik van Riel 


[PATCH] mm: madvise: add description for MADV_WIPEONFORK and MADV_KEEPONFORK

2017-09-22 Thread Yang Shi
mm/madvise.c has the brief description about all MADV_ flags, added the
description for the newly added MADV_WIPEONFORK and MADV_KEEPONFORK.

Although man page has the similar information, but it'd better to keep the
consistency with other flags.

Signed-off-by: Yang Shi 
---
 mm/madvise.c | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/mm/madvise.c b/mm/madvise.c
index 21261ff..c6bf572 100644
--- a/mm/madvise.c
+++ b/mm/madvise.c
@@ -749,6 +749,9 @@ static int madvise_inject_error(int behavior,
  *  MADV_DONTFORK - omit this area from child's address space when forking:
  * typically, to avoid COWing pages pinned by get_user_pages().
  *  MADV_DOFORK - cancel MADV_DONTFORK: no longer omit this area when forking.
+ *  MADV_WIPEONFORK - present the child process with zero-filled memory in this
+ *  range after a fork.
+ *  MADV_KEEPONFORK - undo the effect of MADV_WIPEONFORK
  *  MADV_HWPOISON - trigger memory error handler as if the given memory range
  * were corrupted by unrecoverable hardware memory failure.
  *  MADV_SOFT_OFFLINE - try to soft-offline the given range of memory.
@@ -769,7 +772,9 @@ static int madvise_inject_error(int behavior,
  *  zero- success
  *  -EINVAL - start + len < 0, start is not page-aligned,
  * "behavior" is not a valid value, or application
- * is attempting to release locked or shared pages.
+ * is attempting to release locked or shared pages,
+ * or the specified address range includes file, Huge TLB,
+ * MAP_SHARED or VMPFNMAP range.
  *  -ENOMEM - addresses in the specified range are not currently
  * mapped, or are outside the AS of the process.
  *  -EIO- an I/O error occurred while paging in data.
-- 
1.8.3.1