Received: by 10.223.185.116 with SMTP id b49csp1038487wrg; Fri, 16 Feb 2018 11:15:54 -0800 (PST) X-Google-Smtp-Source: AH8x224+S1Gguiy9ruO2rQM/TL6pc3Dgro7KD/aSJOgmw2cdp8xJr/9Cf+OWqYQ40fLTMq+zGNk3 X-Received: by 2002:a17:902:710f:: with SMTP id a15-v6mr6601544pll.87.1518808554018; Fri, 16 Feb 2018 11:15:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518808553; cv=none; d=google.com; s=arc-20160816; b=hb1j4ReVp94iNqQ2EkXdouUc7yySN4T831ruUaQZj3xQZSZPt/hZYCv1v/XffqwrNf XNtqYEWU44Cm+seZ47Q7Q6LHLklPaJBwjEN3k7j9KX7EHtHXhpDt3DoqzJH0SoSXMUkb bG0khvVAwWVw261GaaVHolyhKMiYOJqEyOTiXEyW8S/AzY2j59fudRyekNSvQUOpZLdm jocUK0ZCOdYY2ZXQNSnhWUB+PaKhS3NJmFnS2IOMqFUjrl/jcla1AkuWMc5GlrFws8qN JAGrZxUaxaYaukRfNpHkL5QhyL60KHirMcM4okBgjeXh2xQ8K+3podCrf5vmKbB+x721 +KsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:references:in-reply-to:date :subject:cc:to:from:arc-authentication-results; bh=xF+eXoY4CKS9HJVckT3h/ofG/YQeR4Z/Wm3Qi0/bMrA=; b=IgDqAl2URKXB5sb0csqPbjxnWZ1J1Bw1/txhhkVDsm9gu+JuVUPDa7so6T3Pjw6Yp1 U+0VbegO1s9IOzpiOAJ4OD0dtV0NHu2ny/VQPWE7tB99cbt1nLfhbI5xjvWADI6o8wh2 uUMfutevJiu+X10kadwN2DLZrO3eSUvzVdMH2Mbcc6KLzA6Mh+nuv28D0tM3oP3JcGQE rfV4ANyQPiaPu/BhogcNl6NvETTf+PVYUYhSA/hVp6WSYbOCgpzL5FYTyB6NzcedngRZ WNgxznqRkMVYw7go1vz719HiiGzUH43OVzXMmk6twvALJRk4iYb3/k47FZjv1W2YbFTL 3jZw== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j25si4340372pgn.657.2018.02.16.11.15.38; Fri, 16 Feb 2018 11:15:53 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755873AbeBPP0k (ORCPT + 99 others); Fri, 16 Feb 2018 10:26:40 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:54668 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755387AbeBPP0e (ORCPT ); Fri, 16 Feb 2018 10:26:34 -0500 Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w1GFNX7F121714 for ; Fri, 16 Feb 2018 10:26:34 -0500 Received: from e06smtp12.uk.ibm.com (e06smtp12.uk.ibm.com [195.75.94.108]) by mx0a-001b2d01.pphosted.com with ESMTP id 2g5x6f1yyb-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Fri, 16 Feb 2018 10:26:33 -0500 Received: from localhost by e06smtp12.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 16 Feb 2018 15:26:29 -0000 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp12.uk.ibm.com (192.168.101.142) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 16 Feb 2018 15:26:22 -0000 Received: from d06av24.portsmouth.uk.ibm.com (mk.ibm.com [9.149.105.60]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w1GFQL3464946362; Fri, 16 Feb 2018 15:26:21 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6DE6E42045; Fri, 16 Feb 2018 15:19:05 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 629AD4203F; Fri, 16 Feb 2018 15:19:03 +0000 (GMT) Received: from nimbus.lab.toulouse-stg.fr.ibm.com (unknown [9.145.186.2]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 16 Feb 2018 15:19:03 +0000 (GMT) From: Laurent Dufour To: paulmck@linux.vnet.ibm.com, peterz@infradead.org, akpm@linux-foundation.org, kirill@shutemov.name, ak@linux.intel.com, mhocko@kernel.org, dave@stgolabs.net, jack@suse.cz, Matthew Wilcox , benh@kernel.crashing.org, mpe@ellerman.id.au, paulus@samba.org, Thomas Gleixner , Ingo Molnar , hpa@zytor.com, Will Deacon , Sergey Senozhatsky , Andrea Arcangeli , Alexei Starovoitov , kemi.wang@intel.com, sergey.senozhatsky.work@gmail.com, Daniel Jordan Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, haren@linux.vnet.ibm.com, khandual@linux.vnet.ibm.com, npiggin@gmail.com, bsingharora@gmail.com, Tim Chen , linuxppc-dev@lists.ozlabs.org, x86@kernel.org Subject: [PATCH v8 12/24] mm/migrate: Pass vm_fault pointer to migrate_misplaced_page() Date: Fri, 16 Feb 2018 16:25:26 +0100 X-Mailer: git-send-email 2.7.4 In-Reply-To: <1518794738-4186-1-git-send-email-ldufour@linux.vnet.ibm.com> References: <1518794738-4186-1-git-send-email-ldufour@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18021615-0008-0000-0000-000004D08097 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18021615-0009-0000-0000-00001E63856E Message-Id: <1518794738-4186-13-git-send-email-ldufour@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2018-02-16_06:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1802160183 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org migrate_misplaced_page() is only called during the page fault handling so it's better to pass the pointer to the struct vm_fault instead of the vma. This way during the speculative page fault path the saved vma->vm_flags could be used. Signed-off-by: Laurent Dufour --- include/linux/migrate.h | 4 ++-- mm/memory.c | 2 +- mm/migrate.c | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/linux/migrate.h b/include/linux/migrate.h index 0c6fe904bc97..08960ec74246 100644 --- a/include/linux/migrate.h +++ b/include/linux/migrate.h @@ -126,14 +126,14 @@ static inline void __ClearPageMovable(struct page *page) #ifdef CONFIG_NUMA_BALANCING extern bool pmd_trans_migrating(pmd_t pmd); extern int migrate_misplaced_page(struct page *page, - struct vm_area_struct *vma, int node); + struct vm_fault *vmf, int node); #else static inline bool pmd_trans_migrating(pmd_t pmd) { return false; } static inline int migrate_misplaced_page(struct page *page, - struct vm_area_struct *vma, int node) + struct vm_fault *vmf, int node) { return -EAGAIN; /* can't migrate now */ } diff --git a/mm/memory.c b/mm/memory.c index 66a79f44f303..bd5de1aa3f7a 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -3903,7 +3903,7 @@ static int do_numa_page(struct vm_fault *vmf) } /* Migrate to the requested node */ - migrated = migrate_misplaced_page(page, vma, target_nid); + migrated = migrate_misplaced_page(page, vmf, target_nid); if (migrated) { page_nid = target_nid; flags |= TNF_MIGRATED; diff --git a/mm/migrate.c b/mm/migrate.c index 5d0dc7b85f90..ad8692ca6a4f 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -1900,7 +1900,7 @@ bool pmd_trans_migrating(pmd_t pmd) * node. Caller is expected to have an elevated reference count on * the page that will be dropped by this function before returning. */ -int migrate_misplaced_page(struct page *page, struct vm_area_struct *vma, +int migrate_misplaced_page(struct page *page, struct vm_fault *vmf, int node) { pg_data_t *pgdat = NODE_DATA(node); @@ -1913,7 +1913,7 @@ int migrate_misplaced_page(struct page *page, struct vm_area_struct *vma, * with execute permissions as they are probably shared libraries. */ if (page_mapcount(page) != 1 && page_is_file_cache(page) && - (vma->vm_flags & VM_EXEC)) + (vmf->vma_flags & VM_EXEC)) goto out; /* -- 2.7.4