Re: [PATCH 13/18] exec: make exec path waiting for mmap_sem killable

From
Oleg Nesterov <oleg@redhat.com>
Date
2016-02-29 17:23:45
Also in
linux-mm, lkml
Reply to
Michal Hocko, 2016-02-29
On 02/29, Michal Hocko wrote:
quoted hunk ↗ jump to hunk
@@ -267,7 +267,10 @@ static int __bprm_mm_init(struct linux_binprm *bprm)
 	if (!vma)
 		return -ENOMEM;
 
-	down_write(&mm->mmap_sem);
+	if (down_write_killable(&mm->mmap_sem)) {
+		err = -EINTR;
+		goto err_free;
+	}
 	vma->vm_mm = mm;
I won't argue, but this looks unnecessary. Nobody else can see this new mm,
down_write() can't block.

In fact I think we can just remove down_write/up_write here. Except perhaps
there is lockdep_assert_held() somewhere in these paths.

Oleg.
Thread (68 messages) 68 messages, 8 authors, last reply 2016-03-11
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help