Received: by 10.223.176.5 with SMTP id f5csp1994938wra; Sun, 4 Feb 2018 17:43:41 -0800 (PST) X-Google-Smtp-Source: AH8x2242FClmByOsYDE5SKFJtT9EUf9qfcplXUOthP1l0g1IBfyjhV3pev3Ww0yuUEHT5IBjpE7F X-Received: by 10.99.115.92 with SMTP id d28mr4693118pgn.359.1517795021780; Sun, 04 Feb 2018 17:43:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517795021; cv=none; d=google.com; s=arc-20160816; b=H92AZn6VEcM6s8597YfelcTdWeFUR+F+OFJ8F6kr0Witze1GC2JF03grqMqAEe3X0X WS+TCT39Zq14CE+Q1vCzTmByznwownYjPtJeTJYDdlbKK8P4fVTDF4P7fuSA843dIEIJ csROU+W0IsoxDLpTxxHgmeCl8AxXg0FcWxtMJQw18ZW4v1nHt5NGJPCFVYjGS99aGJ1q ng1CIqCQYOZnLuAAwzG5TELqPhpjfc/PrKovlZ6FvXUwL60uG+HbAybZkdsqsun2ghFn 1WAHaYeEhWUg7mUyColmgRHoxO91ZfTQZjOGeKgnlVT9D0xRKTphVv68fBFnkGlkrKto gF4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=cp/ZPx16Y5+VmDzxMSMmDGIaF9RPnIQiGsdDjsDxm+Q=; b=O9imQf2Hm+PR7JEPvBEp70Hpx5Ao/P2lVfwn+O4VWOdcG7lbnMWy8858LLE/D0I6Zf miu5w9XNLLn1hoKL9+0l3joHCLv4aeG4YQBHZVwbosgt39mUj7g5UpQLd+lAPJ5lt53S KkU7vDQIH7DfLyDisyU+yIzi59ddaIh9nY44tfUPO0yIa7SkfE5+pH8Apd7r6ZB3YGjv GipK9mH/87ZdC85P5U+7vgEVLn0BYtw/HUuvuLV8zNil0zJWNgHxZYUNOaVF4BVZ2AOt jp8bOCIjBw2aMpmWUaEkR+WwKogY7ic9FubFqVSUcQCde96oxO/Vgh1H/fri1t5NT6Oa 4DTQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o6-v6si3497955plk.288.2018.02.04.17.43.27; Sun, 04 Feb 2018 17:43:41 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752936AbeBEBls (ORCPT + 99 others); Sun, 4 Feb 2018 20:41:48 -0500 Received: from mx2.suse.de ([195.135.220.15]:44106 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752343AbeBEB2V (ORCPT ); Sun, 4 Feb 2018 20:28:21 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 60F9DADEC; Mon, 5 Feb 2018 01:28:00 +0000 (UTC) From: Davidlohr Bueso To: akpm@linux-foundation.org, mingo@kernel.org Cc: peterz@infradead.org, ldufour@linux.vnet.ibm.com, jack@suse.cz, mhocko@kernel.org, kirill.shutemov@linux.intel.com, mawilcox@microsoft.com, mgorman@techsingularity.net, dave@stgolabs.net, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Davidlohr Bueso Subject: [PATCH 19/64] mm/mlock: use mm locking wrappers Date: Mon, 5 Feb 2018 02:27:09 +0100 Message-Id: <20180205012754.23615-20-dbueso@wotan.suse.de> X-Mailer: git-send-email 2.12.3 In-Reply-To: <20180205012754.23615-1-dbueso@wotan.suse.de> References: <20180205012754.23615-1-dbueso@wotan.suse.de> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Davidlohr Bueso Conversion is straightforward, mmap_sem is used within the same function context. No changes in semantics. Signed-off-by: Davidlohr Bueso --- mm/mlock.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/mm/mlock.c b/mm/mlock.c index 3f6bd953e8b0..dfd175b2cf20 100644 --- a/mm/mlock.c +++ b/mm/mlock.c @@ -686,7 +686,7 @@ static __must_check int do_mlock(unsigned long start, size_t len, lock_limit >>= PAGE_SHIFT; locked = len >> PAGE_SHIFT; - if (down_write_killable(¤t->mm->mmap_sem)) + if (mm_write_lock_killable(current->mm, &mmrange)) return -EINTR; locked += current->mm->locked_vm; @@ -705,7 +705,7 @@ static __must_check int do_mlock(unsigned long start, size_t len, if ((locked <= lock_limit) || capable(CAP_IPC_LOCK)) error = apply_vma_lock_flags(start, len, flags, &mmrange); - up_write(¤t->mm->mmap_sem); + mm_write_unlock(current->mm, &mmrange); if (error) return error; @@ -741,10 +741,10 @@ SYSCALL_DEFINE2(munlock, unsigned long, start, size_t, len) len = PAGE_ALIGN(len + (offset_in_page(start))); start &= PAGE_MASK; - if (down_write_killable(¤t->mm->mmap_sem)) + if (mm_write_lock_killable(current->mm, &mmrange)) return -EINTR; ret = apply_vma_lock_flags(start, len, 0, &mmrange); - up_write(¤t->mm->mmap_sem); + mm_write_unlock(current->mm, &mmrange); return ret; } @@ -811,14 +811,14 @@ SYSCALL_DEFINE1(mlockall, int, flags) lock_limit = rlimit(RLIMIT_MEMLOCK); lock_limit >>= PAGE_SHIFT; - if (down_write_killable(¤t->mm->mmap_sem)) + if (mm_write_lock_killable(current->mm, &mmrange)) return -EINTR; ret = -ENOMEM; if (!(flags & MCL_CURRENT) || (current->mm->total_vm <= lock_limit) || capable(CAP_IPC_LOCK)) ret = apply_mlockall_flags(flags, &mmrange); - up_write(¤t->mm->mmap_sem); + mm_write_unlock(current->mm, &mmrange); if (!ret && (flags & MCL_CURRENT)) mm_populate(0, TASK_SIZE); @@ -830,10 +830,10 @@ SYSCALL_DEFINE0(munlockall) int ret; DEFINE_RANGE_LOCK_FULL(mmrange); - if (down_write_killable(¤t->mm->mmap_sem)) + if (mm_write_lock_killable(current->mm, &mmrange)) return -EINTR; ret = apply_mlockall_flags(0, &mmrange); - up_write(¤t->mm->mmap_sem); + mm_write_unlock(current->mm, &mmrange); return ret; } -- 2.13.6