Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932965Ab1CWOrh (ORCPT ); Wed, 23 Mar 2011 10:47:37 -0400 Received: from mout.perfora.net ([74.208.4.194]:55428 "EHLO mout.perfora.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755524Ab1CWOrd (ORCPT ); Wed, 23 Mar 2011 10:47:33 -0400 From: Stephen Wilson To: Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" Cc: Andrew Morton , Alexander Viro , Michel Lespinasse , Andi Kleen , Rik van Riel , KOSAKI Motohiro , Matt Mackall , David Rientjes , Nick Piggin , Andrea Arcangeli , Mel Gorman , Hugh Dickins , x86@kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Stephen Wilson Subject: [PATCH v2 resend 06/12] mm: use mm_struct to resolve gate vma's in __get_user_pages Date: Wed, 23 Mar 2011 10:43:55 -0400 Message-Id: <1300891441-16280-7-git-send-email-wilsons@start.ca> X-Mailer: git-send-email 1.7.3.5 In-Reply-To: <1300891441-16280-1-git-send-email-wilsons@start.ca> References: <1300891441-16280-1-git-send-email-wilsons@start.ca> X-Provags-ID: V02:K0:eKLsRMewRnUiM0ZgE8KH1ig/GNo0dGA5e/WpSO1r1wi Qxa4IkAVOgywFDohJd/n/fqjOzBDdqR7w4pxvUS3uzQ/5JHNkF SQdYn2YxHxHTsIUlQvxqZ2T0kQG2k9fF/AZWBtYJqAezFx6Kvg 4oBv4F2qfJ961Rr+BWjzyulf68Hju+ycH6PcGQeIlDGSE6k3p1 2XijtJpqvRsdlp9zZHInBJNS+PMjUmjQNRVus92fr8= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1956 Lines: 61 We now check if a requested user page overlaps a gate vma using the supplied mm instead of the supplied task. The given task is now used solely for accounting purposes and may be NULL. Signed-off-by: Stephen Wilson --- mm/memory.c | 18 +++++++++++------- 1 files changed, 11 insertions(+), 7 deletions(-) diff --git a/mm/memory.c b/mm/memory.c index 3863e86..36445e3 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -1437,9 +1437,9 @@ int __get_user_pages(struct task_struct *tsk, struct mm_struct *mm, struct vm_area_struct *vma; vma = find_extend_vma(mm, start); - if (!vma && in_gate_area(tsk->mm, start)) { + if (!vma && in_gate_area(mm, start)) { unsigned long pg = start & PAGE_MASK; - struct vm_area_struct *gate_vma = get_gate_vma(tsk->mm); + struct vm_area_struct *gate_vma = get_gate_vma(mm); pgd_t *pgd; pud_t *pud; pmd_t *pmd; @@ -1533,10 +1533,13 @@ int __get_user_pages(struct task_struct *tsk, struct mm_struct *mm, return i ? i : -EFAULT; BUG(); } - if (ret & VM_FAULT_MAJOR) - tsk->maj_flt++; - else - tsk->min_flt++; + + if (tsk) { + if (ret & VM_FAULT_MAJOR) + tsk->maj_flt++; + else + tsk->min_flt++; + } if (ret & VM_FAULT_RETRY) { *nonblocking = 0; @@ -1581,7 +1584,8 @@ int __get_user_pages(struct task_struct *tsk, struct mm_struct *mm, /** * get_user_pages() - pin user pages in memory - * @tsk: task_struct of target task + * @tsk: the task_struct to use for page fault accounting, or + * NULL if faults are not to be recorded. * @mm: mm_struct of target mm * @start: starting user address * @nr_pages: number of pages from start to pin -- 1.7.3.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/