From: Lee Schermerhorn <lee.schermerhorn@hp.com>
To: akpm@linux-foundation.org
Cc: riel@redhat.com, linux-mm <linux-mm@kvack.org>,
kosaki.motohiro@jp.fujitsu.com, Eric.Whitney@hp.com
Subject: [PATCH 4/7] Mlock: fix return value for munmap/mlock vma race
Date: Fri, 22 Aug 2008 17:10:53 -0400 [thread overview]
Message-ID: <20080822211053.29898.60401.sendpatchset@murky.usa.hp.com> (raw)
In-Reply-To: <20080822211028.29898.82599.sendpatchset@murky.usa.hp.com>
atop patch:
mmap-handle-mlocked-pages-during-map-remap-unmap.patch
with locked_vm adjustment backout patch.
Now, We call downgrade_write(&mm->mmap_sem) at begin of mlock.
It increase mlock scalability.
But if mlock and munmap conflict happend, We can find vma gone.
At that time, kernel should return ENOMEM because mlock after munmap return ENOMEM.
(in addition, EAGAIN indicate "please try again", but mlock() called again cause error again)
This problem is theoretical issue.
I can't reproduce that vma gone on my box, but fixes is better.
Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
mm/mlock.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
Index: linux-2.6.27-rc4-mmotm/mm/mlock.c
===================================================================
--- linux-2.6.27-rc4-mmotm.orig/mm/mlock.c 2008-08-21 11:37:45.000000000 -0400
+++ linux-2.6.27-rc4-mmotm/mm/mlock.c 2008-08-21 11:58:05.000000000 -0400
@@ -283,7 +283,7 @@ long mlock_vma_pages_range(struct vm_are
vma = find_vma(mm, start);
/* non-NULL vma must contain @start, but need to check @end */
if (!vma || end > vma->vm_end)
- return -EAGAIN;
+ return -ENOMEM;
return 0; /* hide other errors from mmap(), et al */
}
@@ -405,7 +405,7 @@ success:
*prev = find_vma(mm, start);
/* non-NULL *prev must contain @start, but need to check @end */
if (!(*prev) || end > (*prev)->vm_end)
- ret = -EAGAIN;
+ ret = -ENOMEM;
} else {
/*
* TODO: for unlocking, pages will already be resident, so
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2008-08-22 21:10 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-22 21:10 [Patch 0/7] Mlock: doc, patch grouping and error return cleanups Lee Schermerhorn
2008-08-22 21:10 ` [PATCH 1/7] Mlock: fix __mlock_vma_pages_range comment block Lee Schermerhorn
2008-08-22 21:10 ` [PATCH 2/7] Mlock: backout locked_vm adjustment during mmap() Lee Schermerhorn
2008-08-22 21:10 ` [PATCH 3/7] Mlock: resubmit locked_vm adjustment as separate patch Lee Schermerhorn
2008-08-22 23:11 ` Andrew Morton
2008-08-25 13:01 ` Lee Schermerhorn
2008-08-22 21:10 ` Lee Schermerhorn [this message]
2008-08-22 21:11 ` [PATCH 5/7] Mlock: update locked_vm on munmap() of mlocked() region Lee Schermerhorn
2008-08-22 21:11 ` [PATCH 6/7] Mlock: revert mainline handling of mlock error return Lee Schermerhorn
2008-08-22 21:11 ` [PATCH 7/7] Mlock: make mlock error return Posixly Correct Lee Schermerhorn
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080822211053.29898.60401.sendpatchset@murky.usa.hp.com \
--to=lee.schermerhorn@hp.com \
--cc=Eric.Whitney@hp.com \
--cc=akpm@linux-foundation.org \
--cc=kosaki.motohiro@jp.fujitsu.com \
--cc=linux-mm@kvack.org \
--cc=riel@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox