From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752507Ab2F1NEa (ORCPT ); Thu, 28 Jun 2012 09:04:30 -0400 Received: from mx1.redhat.com ([209.132.183.28]:62251 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755529Ab2F1M6G (ORCPT ); Thu, 28 Jun 2012 08:58:06 -0400 From: Andrea Arcangeli To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: Hillf Danton , Dan Smith , Peter Zijlstra , Linus Torvalds , Andrew Morton , Thomas Gleixner , Ingo Molnar , Paul Turner , Suresh Siddha , Mike Galbraith , "Paul E. McKenney" , Lai Jiangshan , Bharata B Rao , Lee Schermerhorn , Rik van Riel , Johannes Weiner , Srivatsa Vaddagiri , Christoph Lameter , Alex Shi , Mauricio Faria de Oliveira , Konrad Rzeszutek Wilk , Don Morris , Benjamin Herrenschmidt Subject: [PATCH 08/40] autonuma: teach gup_fast about pte_numa Date: Thu, 28 Jun 2012 14:55:48 +0200 Message-Id: <1340888180-15355-9-git-send-email-aarcange@redhat.com> In-Reply-To: <1340888180-15355-1-git-send-email-aarcange@redhat.com> References: <1340888180-15355-1-git-send-email-aarcange@redhat.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org gup_fast will skip over non present ptes (pte_numa requires the pte to be non present). So no explicit check is needed for pte_numa in the pte case. gup_fast will also automatically skip over THP when the trans huge pmd is non present (pmd_numa requires the pmd to be non present). But for the special pmd mode scan of knuma_scand (/sys/kernel/mm/autonuma/knuma_scand/pmd == 1), the pmd may be of numa type (so non present too), the pte may be present. gup_pte_range wouldn't notice the pmd is of numa type. So to avoid losing a NUMA hinting page fault with gup_fast we need an explicit check for pmd_numa() here to be sure it will fault through gup -> handle_mm_fault. Signed-off-by: Andrea Arcangeli --- arch/x86/mm/gup.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/arch/x86/mm/gup.c b/arch/x86/mm/gup.c index dd74e46..bf36575 100644 --- a/arch/x86/mm/gup.c +++ b/arch/x86/mm/gup.c @@ -164,7 +164,7 @@ static int gup_pmd_range(pud_t pud, unsigned long addr, unsigned long end, * wait_split_huge_page() would never return as the * tlb flush IPI wouldn't run. */ - if (pmd_none(pmd) || pmd_trans_splitting(pmd)) + if (pmd_none(pmd) || pmd_trans_splitting(pmd) || pmd_numa(pmd)) return 0; if (unlikely(pmd_large(pmd))) { if (!gup_huge_pmd(pmd, addr, next, write, pages, nr))