Received: by 10.223.176.5 with SMTP id f5csp1991745wra; Sun, 4 Feb 2018 17:38:03 -0800 (PST) X-Google-Smtp-Source: AH8x225xGLjOOsIvMtYibVK15156J+Pp5gLI80wGOa47hFv7DTAdt5e9pw2H0GQY504k16HFx9XQ X-Received: by 10.98.56.150 with SMTP id f144mr46498281pfa.167.1517794683851; Sun, 04 Feb 2018 17:38:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517794683; cv=none; d=google.com; s=arc-20160816; b=JOD1yb63x9FKoffhF0oPY83yiwOmeW2zo/izGH8hikFq6inP4JqR+CAHlyYyBMEnJe Zn0maLBYVwBQc0Ff6jYhJxP1nHTL5PmINyTLxUjHCa6LfrwDI/Ic5AOAX5TtDM3tkAZm AIVQylJYBqApxms0gAmwY6qgAy9YU8cJ7C/OETTPCdaAmku+LYtSuHxbU5qJ+T764ZBm FqWUmKE0uk3EKgTHftl5DqYlEi402md/Nh+B986clDioMne9OPBh6Woyn0RhC+Jq7art Ojl5GKN2d15Wr7w/vD80WyeRy8Xz14mm+ivto4O72GO+WPUAY16SYSM5cjNV59lzuZ3f Id0Q== 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=AOzzl0rJqfr2M7ScIej6YlKy2rRdSqJ8IW8f7tdyabw=; b=Eu8cE5HfQMG5B1JqFbK/XS6V5/A7KP0i2Onu6FhrCdPYJac5BVIslB5Eg38E+lO5Ny rrkWxYwEwtT0CxrnXbCdcmVSifcere/sDLImE1iVmsiY8fabfqcY5vXmgtTbcxdrMY4m ROAbVpchl72LjjNO7dILIiTSWu9JTkoH8gi9an6uFLzuaJvW1aDLif/oCsy/ARgkxCBs GAWV8A4pQCdBL1Kkpn6UBUdD3OjifnU/DlWn64CgJmSAYl7Uunha8cRcl2aIG+2ziBqB m6B1d9HGAtgJcZ7rt04ELLHBzxSkRngsk8jN9HXlVL7SIsObH2lzJ2MENeicYbdLXhbY VnSw== 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 b1si4812548pgs.815.2018.02.04.17.37.49; Sun, 04 Feb 2018 17:38:03 -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 S1752979AbeBEBgt (ORCPT + 99 others); Sun, 4 Feb 2018 20:36:49 -0500 Received: from mx2.suse.de ([195.135.220.15]:44098 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752250AbeBEB2y (ORCPT ); Sun, 4 Feb 2018 20:28:54 -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 15DAFAE08; 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 40/64] arch/sh: use mm locking wrappers Date: Mon, 5 Feb 2018 02:27:30 +0100 Message-Id: <20180205012754.23615-41-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/sh/kernel/sys_sh.c | 7 ++++--- arch/sh/kernel/vsyscall/vsyscall.c | 5 +++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/arch/sh/kernel/sys_sh.c b/arch/sh/kernel/sys_sh.c index 724911c59e7d..35b91b6c8d34 100644 --- a/arch/sh/kernel/sys_sh.c +++ b/arch/sh/kernel/sys_sh.c @@ -58,6 +58,7 @@ asmlinkage long sys_mmap2(unsigned long addr, unsigned long len, asmlinkage int sys_cacheflush(unsigned long addr, unsigned long len, int op) { struct vm_area_struct *vma; + DEFINE_RANGE_LOCK_FULL(mmrange); if ((op <= 0) || (op > (CACHEFLUSH_D_PURGE|CACHEFLUSH_I))) return -EINVAL; @@ -69,10 +70,10 @@ asmlinkage int sys_cacheflush(unsigned long addr, unsigned long len, int op) if (addr + len < addr) return -EFAULT; - down_read(¤t->mm->mmap_sem); + mm_read_lock(current->mm, &mmrange); vma = find_vma (current->mm, addr); if (vma == NULL || addr < vma->vm_start || addr + len > vma->vm_end) { - up_read(¤t->mm->mmap_sem); + mm_read_unlock(current->mm, &mmrange); return -EFAULT; } @@ -91,6 +92,6 @@ asmlinkage int sys_cacheflush(unsigned long addr, unsigned long len, int op) if (op & CACHEFLUSH_I) flush_icache_range(addr, addr+len); - up_read(¤t->mm->mmap_sem); + mm_read_unlock(current->mm, &mmrange); return 0; } diff --git a/arch/sh/kernel/vsyscall/vsyscall.c b/arch/sh/kernel/vsyscall/vsyscall.c index cc0cc5b4ff18..17520e6b7783 100644 --- a/arch/sh/kernel/vsyscall/vsyscall.c +++ b/arch/sh/kernel/vsyscall/vsyscall.c @@ -63,8 +63,9 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp) struct mm_struct *mm = current->mm; unsigned long addr; int ret; + DEFINE_RANGE_LOCK_FULL(mmrange); - if (down_write_killable(&mm->mmap_sem)) + if (mm_write_lock_killable(mm, &mmrange)) return -EINTR; addr = get_unmapped_area(NULL, 0, PAGE_SIZE, 0, 0); @@ -83,7 +84,7 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp) current->mm->context.vdso = (void *)addr; up_fail: - up_write(&mm->mmap_sem); + mm_write_unlock(mm, &mmrange); return ret; } -- 2.13.6