Received: by 10.223.176.5 with SMTP id f5csp1992287wra; Sun, 4 Feb 2018 17:38:51 -0800 (PST) X-Google-Smtp-Source: AH8x225zGr+L3+H4pQvDyTtc6JcNzQfcZl87TR6JssAhvwr+3imMSdVOhQ0TivYg7cmylZTQd7f5 X-Received: by 10.98.172.7 with SMTP id v7mr7315838pfe.66.1517794731247; Sun, 04 Feb 2018 17:38:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517794731; cv=none; d=google.com; s=arc-20160816; b=emyghoBgPWMfgrA/8Kq2uPnqD6vyIi2K7sAifNfHGzeL+JmMqxeA90iVWCbKJE/JHk whaW0osChVydZLOVPKUushm1NN+/wQZbtkXRjx/i5Wa87X6ggfmZl87qLjc3Nq3q7jij kgvcJbjY+t7tvp4CsTZTJD3DCOxEI+86seWqe8I66bI3FNq/GQdZjDSyGDanvsvl61Xu tC3vPZb+njMJjgQSenVU1Mqyib7WtwqfiZUgCb48iqx7UveNSEZchFsPiVOJimXEz4y9 DA3w3lpDANfO3MS4itXsGkWkdLfaD/MgI/1+CVY+iynqbeTXxNfsHNzl1/F7TmRr9mb4 frsQ== 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=A7wAT6gtt7WvywN/qRkFTV5GE3Wzu5/2V2eay9v1BAM=; b=qCGYlh0yMGF5iUTbv53GXHhAOiRSnUC1SGLRRCBb+QH4WGTC9lR67wXObvzh1HymmI X0HjGX5GLRkXJX835tl0c5ZtnxEfyYfy2gwe5z+wlycykkiTYo5VHug+b5N8ido/AnKm fzdiyjgnNsrN9ITSD/kfIv9YPQ2WCtcZn1awXCYLfUWS1li1EShDHWsZGOct9sUVuiYM lN5d2zWnbTa2zg19Vx5j5V58xK8tbNnd6xLRjylxzUQXju2a1covM/IGEZqLxWdiCo1w 2VLXGa0sFaznih/e9Z+3IJ8V7sT6HkdIECRNRTPbqfQjwiqOzL0aKvirY+9eCH9EwS/8 a2nQ== 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 i9si158657pfd.173.2018.02.04.17.38.36; Sun, 04 Feb 2018 17:38:51 -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 S1752082AbeBEBgV (ORCPT + 99 others); Sun, 4 Feb 2018 20:36:21 -0500 Received: from mx2.suse.de ([195.135.220.15]:44112 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752760AbeBEB3F (ORCPT ); Sun, 4 Feb 2018 20:29:05 -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 2153CAE09; Mon, 5 Feb 2018 01:28:01 +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 43/64] arch/hexagon: use mm locking wrappers Date: Mon, 5 Feb 2018 02:27:33 +0100 Message-Id: <20180205012754.23615-44-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 This becomes quite straightforward with the mmrange in place. Signed-off-by: Davidlohr Bueso --- arch/hexagon/kernel/vdso.c | 5 +++-- arch/hexagon/mm/vm_fault.c | 8 ++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/arch/hexagon/kernel/vdso.c b/arch/hexagon/kernel/vdso.c index 3ea968415539..53e3db1b54f1 100644 --- a/arch/hexagon/kernel/vdso.c +++ b/arch/hexagon/kernel/vdso.c @@ -64,8 +64,9 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp) int ret; unsigned long vdso_base; struct mm_struct *mm = current->mm; + DEFINE_RANGE_LOCK_FULL(mmrange); - if (down_write_killable(&mm->mmap_sem)) + if (mm_write_lock_killable(mm, &mmrange)) return -EINTR; /* Try to get it loaded right near ld.so/glibc. */ @@ -89,7 +90,7 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp) mm->context.vdso = (void *)vdso_base; up_fail: - up_write(&mm->mmap_sem); + mm_write_unlock(mm, &mmrange); return ret; } diff --git a/arch/hexagon/mm/vm_fault.c b/arch/hexagon/mm/vm_fault.c index 7d6ada2c2230..58203949486e 100644 --- a/arch/hexagon/mm/vm_fault.c +++ b/arch/hexagon/mm/vm_fault.c @@ -69,7 +69,7 @@ void do_page_fault(unsigned long address, long cause, struct pt_regs *regs) if (user_mode(regs)) flags |= FAULT_FLAG_USER; retry: - down_read(&mm->mmap_sem); + mm_read_lock(mm, &mmrange); vma = find_vma(mm, address); if (!vma) goto bad_area; @@ -122,11 +122,11 @@ void do_page_fault(unsigned long address, long cause, struct pt_regs *regs) } } - up_read(&mm->mmap_sem); + mm_read_unlock(mm, &mmrange); return; } - up_read(&mm->mmap_sem); + mm_read_unlock(mm, &mmrange); /* Handle copyin/out exception cases */ if (!user_mode(regs)) @@ -155,7 +155,7 @@ void do_page_fault(unsigned long address, long cause, struct pt_regs *regs) return; bad_area: - up_read(&mm->mmap_sem); + mm_read_unlock(mm, &mmrange); if (user_mode(regs)) { info.si_signo = SIGSEGV; -- 2.13.6