From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C676AC433FE for ; Wed, 9 Dec 2020 17:59:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8E55423C92 for ; Wed, 9 Dec 2020 17:59:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730796AbgLIR7T (ORCPT ); Wed, 9 Dec 2020 12:59:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40644 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727905AbgLIR7M (ORCPT ); Wed, 9 Dec 2020 12:59:12 -0500 Received: from mail-lf1-x141.google.com (mail-lf1-x141.google.com [IPv6:2a00:1450:4864:20::141]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 780E6C0613D6 for ; Wed, 9 Dec 2020 09:58:32 -0800 (PST) Received: by mail-lf1-x141.google.com with SMTP id l11so4356453lfg.0 for ; Wed, 09 Dec 2020 09:58:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=uJaVhTpiMPaliRW1BsTVPR0HUZ5LPD9/lyKWp6voxZY=; b=W3TAZiMxgQtdmGJSBJFklYY9V2kwPDqdPrz6VB+jV0dmuZj2xY806aorny+f833fr0 b8e17lxLA8lqeWSjVicsm8ZauNAfVbS1JSChtiKvqoRliqknYvhRrkhxg/15OsDnB8Ae F7O6VFdwmN7mFS6k9yL922iGj3GMtLKU5aDW0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=uJaVhTpiMPaliRW1BsTVPR0HUZ5LPD9/lyKWp6voxZY=; b=MruqyttjjlYhAW/oiQ3qO8nTHBnpEIXaHbcMlOCSsrTyn2NHQxBVQ00XVJc96PUNox girE5mnLhi4fsdJH3fGqcNo8yHRp8oyv1z2Jj+Ce4WiGLzM57zaxmIYUBlp8OldCBH5p oMdEaLrQOmigREW+jGoggER1iX+tgDHXIS3Z5ba1PWy+E+1YLl29YrTHBZuUk5crjla0 EWVA5j6GZvKfe0+6Pbhm6CMk3UaYycBgOteV2RCb/Nt7nB24iJcS7j5NFWMa4jZould/ +EqRTyeRHiN0NqIXitbPEfFkpCBIe2Dui161fDX3JtYYKUNWbrWnRHg4ORNFCnoNT3XN gIHg== X-Gm-Message-State: AOAM533+QU+IIf9akZoguPM65QCN3h+/GTCyBw6BOLwynMI26B5vNhza 1kCuZZDJ6Afuf/OydPwN4bG8sdu834asvg== X-Google-Smtp-Source: ABdhPJywQQVfQN7R9x6MqZGIfSNY3xfPhKgka1JXlWkxQ3iLip81ftpcnh+iYusVheMWqo253+xXfg== X-Received: by 2002:ac2:50d0:: with SMTP id h16mr1297886lfm.300.1607536710496; Wed, 09 Dec 2020 09:58:30 -0800 (PST) Received: from mail-lj1-f170.google.com (mail-lj1-f170.google.com. [209.85.208.170]) by smtp.gmail.com with ESMTPSA id w204sm242736lff.241.2020.12.09.09.58.29 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 09 Dec 2020 09:58:29 -0800 (PST) Received: by mail-lj1-f170.google.com with SMTP id y16so3473163ljk.1 for ; Wed, 09 Dec 2020 09:58:29 -0800 (PST) X-Received: by 2002:a2e:5750:: with SMTP id r16mr1446782ljd.61.1607536708800; Wed, 09 Dec 2020 09:58:28 -0800 (PST) MIME-Version: 1.0 References: <20201209163950.8494-1-will@kernel.org> <20201209163950.8494-2-will@kernel.org> In-Reply-To: <20201209163950.8494-2-will@kernel.org> From: Linus Torvalds Date: Wed, 9 Dec 2020 09:58:12 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 1/2] mm: Allow architectures to request 'old' entries when prefaulting To: Will Deacon Cc: Linux Kernel Mailing List , Linux-MM , Linux ARM , Catalin Marinas , Jan Kara , Minchan Kim , Andrew Morton , "Kirill A . Shutemov" , Vinayak Menon , Android Kernel Team Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Dec 9, 2020 at 8:40 AM Will Deacon wrote: > > @@ -3978,8 +3994,17 @@ static vm_fault_t do_fault_around(struct vm_fault *vmf) > > /* check if the page fault is solved */ > vmf->pte -= (vmf->address >> PAGE_SHIFT) - (address >> PAGE_SHIFT); > - if (!pte_none(*vmf->pte)) > - ret = VM_FAULT_NOPAGE; > + if (pte_none(*vmf->pte)) > + goto out_unlock; > + > + if (vmf->flags & FAULT_FLAG_PREFAULT_OLD) { > + pte_t pte = pte_mkyoung(*vmf->pte); > + if (ptep_set_access_flags(vmf->vma, address, vmf->pte, pte, 0)) > + update_mmu_cache(vmf->vma, address, vmf->pte); > + } Oh, please dear God no. First you incorrectly set it old, and then you conditionally make it young again and as a result force an atomic rwm update and another TLB flush for no good reason. Just make sure that the FAULT_FLAG_PREFAULT_OLD never sets the *actual* address to old. And yes, that probably means that you need to change "alloc_set_pte()" to actually pass in the real address, and leave "vmf->address" alone - so that it can know which ones are prefaulted and which one is real, but that sounds like a good idea anyway. Then you can just make alloc_set_pte() do the right thing in the first place, instead of doing this nasty "lets do it wrong and fix it up later" horror. Linus From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F3AB0C4361B for ; Wed, 9 Dec 2020 17:58:34 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 6A0DA23C8F for ; Wed, 9 Dec 2020 17:58:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6A0DA23C8F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id C366C8D002E; Wed, 9 Dec 2020 12:58:33 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id BC1326B00B4; Wed, 9 Dec 2020 12:58:33 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AD4588D002E; Wed, 9 Dec 2020 12:58:33 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0007.hostedemail.com [216.40.44.7]) by kanga.kvack.org (Postfix) with ESMTP id 9491B6B00B2 for ; Wed, 9 Dec 2020 12:58:33 -0500 (EST) Received: from smtpin23.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 499D6180AD80F for ; Wed, 9 Dec 2020 17:58:33 +0000 (UTC) X-FDA: 77574503706.23.dogs68_1e0c1a8273f1 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin23.hostedemail.com (Postfix) with ESMTP id 1341237609 for ; Wed, 9 Dec 2020 17:58:33 +0000 (UTC) X-HE-Tag: dogs68_1e0c1a8273f1 X-Filterd-Recvd-Size: 4960 Received: from mail-lf1-f66.google.com (mail-lf1-f66.google.com [209.85.167.66]) by imf28.hostedemail.com (Postfix) with ESMTP for ; Wed, 9 Dec 2020 17:58:32 +0000 (UTC) Received: by mail-lf1-f66.google.com with SMTP id r24so4308725lfm.8 for ; Wed, 09 Dec 2020 09:58:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=uJaVhTpiMPaliRW1BsTVPR0HUZ5LPD9/lyKWp6voxZY=; b=W3TAZiMxgQtdmGJSBJFklYY9V2kwPDqdPrz6VB+jV0dmuZj2xY806aorny+f833fr0 b8e17lxLA8lqeWSjVicsm8ZauNAfVbS1JSChtiKvqoRliqknYvhRrkhxg/15OsDnB8Ae F7O6VFdwmN7mFS6k9yL922iGj3GMtLKU5aDW0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=uJaVhTpiMPaliRW1BsTVPR0HUZ5LPD9/lyKWp6voxZY=; b=koj4Rcca5ryG/WKNjPZR8wkO4DEpT/Diax9GHtnQ1KJ8plteQ7w1QlO7f/uOkJuVNb LMlE8TRt3ZfIck04yqhyQhkJ2Bq6HhPJuGe8YRK0Ou2gCCU8Cb07eVm+bzpVD2GpqAzM arG1jd/NGNX/n4oQBVE3x3bBS1nCRIshek9TUP9WwIt76P6ylSm8IjPehpUnthfEXr/3 smxP/gdSwdAYwDWhrG3DdIRpP3QadHpfPXk7aBrZuYv30SGeOB+c6PtYbrrSGvd9tATG NZh6w5/r/OL2MHhW3sSVH3DsTUvFhxTH0hYyC2Qc9L5Q3TA5okSyZZb2pzW+l2pz24Hk b8SQ== X-Gm-Message-State: AOAM53200sCkx9WlACVPnLYuC3iT+uRQyigiyqkCubKk7CnFj9XlbUCv J+coIY3DOb8yJEqC466ZlU9tsTeVGktY9Q== X-Google-Smtp-Source: ABdhPJzbYxsJuGY29EjJ9FFhyy2VDtf7U/2F3yxpC9FPxqzCu07oDdHRbqDSPT0Fm3dwH1zMaZD+9Q== X-Received: by 2002:ac2:548b:: with SMTP id t11mr1357704lfk.181.1607536710309; Wed, 09 Dec 2020 09:58:30 -0800 (PST) Received: from mail-lj1-f171.google.com (mail-lj1-f171.google.com. [209.85.208.171]) by smtp.gmail.com with ESMTPSA id z20sm312338ljh.86.2020.12.09.09.58.29 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 09 Dec 2020 09:58:29 -0800 (PST) Received: by mail-lj1-f171.google.com with SMTP id x23so3441955lji.7 for ; Wed, 09 Dec 2020 09:58:29 -0800 (PST) X-Received: by 2002:a2e:5750:: with SMTP id r16mr1446782ljd.61.1607536708800; Wed, 09 Dec 2020 09:58:28 -0800 (PST) MIME-Version: 1.0 References: <20201209163950.8494-1-will@kernel.org> <20201209163950.8494-2-will@kernel.org> In-Reply-To: <20201209163950.8494-2-will@kernel.org> From: Linus Torvalds Date: Wed, 9 Dec 2020 09:58:12 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 1/2] mm: Allow architectures to request 'old' entries when prefaulting To: Will Deacon Cc: Linux Kernel Mailing List , Linux-MM , Linux ARM , Catalin Marinas , Jan Kara , Minchan Kim , Andrew Morton , "Kirill A . Shutemov" , Vinayak Menon , Android Kernel Team Content-Type: text/plain; charset="UTF-8" X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Wed, Dec 9, 2020 at 8:40 AM Will Deacon wrote: > > @@ -3978,8 +3994,17 @@ static vm_fault_t do_fault_around(struct vm_fault *vmf) > > /* check if the page fault is solved */ > vmf->pte -= (vmf->address >> PAGE_SHIFT) - (address >> PAGE_SHIFT); > - if (!pte_none(*vmf->pte)) > - ret = VM_FAULT_NOPAGE; > + if (pte_none(*vmf->pte)) > + goto out_unlock; > + > + if (vmf->flags & FAULT_FLAG_PREFAULT_OLD) { > + pte_t pte = pte_mkyoung(*vmf->pte); > + if (ptep_set_access_flags(vmf->vma, address, vmf->pte, pte, 0)) > + update_mmu_cache(vmf->vma, address, vmf->pte); > + } Oh, please dear God no. First you incorrectly set it old, and then you conditionally make it young again and as a result force an atomic rwm update and another TLB flush for no good reason. Just make sure that the FAULT_FLAG_PREFAULT_OLD never sets the *actual* address to old. And yes, that probably means that you need to change "alloc_set_pte()" to actually pass in the real address, and leave "vmf->address" alone - so that it can know which ones are prefaulted and which one is real, but that sounds like a good idea anyway. Then you can just make alloc_set_pte() do the right thing in the first place, instead of doing this nasty "lets do it wrong and fix it up later" horror. Linus From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 780D4C4361B for ; Wed, 9 Dec 2020 17:59:48 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 25D5823C92 for ; Wed, 9 Dec 2020 17:59:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 25D5823C92 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=4COSJb0tXX+UEcZC0D41HCx9dRCend3hK5pFPHDHSck=; b=LOdVzL0iVa93KhVFC4C+bCMaD woDIFkIKKstl3cB5peqRtd0pwJYCT5Wz7MHEVbfKxOF8rbwmp1vcr8ijxn7RILDM6dATSuSm4bemp Jsyg1ug2dB0Jipny1H6vfxpcOv5uW2XHyQO24wrxN4Vow6qDAwSpEhBdD7MOnncQNOHTaDHplleKw 2dj3D52UMyTW3QwfyTsdxMEBAtfzRENQbMdW3ObnHAXHKMJQ0H5jg/oflgEMv4Z4d7+rPsTAkGVLs lPdMwDUmzoW2py7Ank1V2Ov7xngfLQ51g/Cn3OE3v8JrEppczsGCMUfOg2h7cqVz9YAjmUl5+WJel y2PNi6bNg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kn3jX-0003Nb-NZ; Wed, 09 Dec 2020 17:58:35 +0000 Received: from mail-lj1-x243.google.com ([2a00:1450:4864:20::243]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kn3jU-0003Mx-H7 for linux-arm-kernel@lists.infradead.org; Wed, 09 Dec 2020 17:58:33 +0000 Received: by mail-lj1-x243.google.com with SMTP id e7so3417445ljg.10 for ; Wed, 09 Dec 2020 09:58:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=uJaVhTpiMPaliRW1BsTVPR0HUZ5LPD9/lyKWp6voxZY=; b=W3TAZiMxgQtdmGJSBJFklYY9V2kwPDqdPrz6VB+jV0dmuZj2xY806aorny+f833fr0 b8e17lxLA8lqeWSjVicsm8ZauNAfVbS1JSChtiKvqoRliqknYvhRrkhxg/15OsDnB8Ae F7O6VFdwmN7mFS6k9yL922iGj3GMtLKU5aDW0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=uJaVhTpiMPaliRW1BsTVPR0HUZ5LPD9/lyKWp6voxZY=; b=Ky7FtKZbNApLC1BNUp+ffSHzNaDbUVHM+Y1e5dCGZrIQLN4U7Lth/G1OC+gjR/nasG a+48G0ferlv9X/KvjkCwpLds8OBF3aG2ehv5tSQkY/L7VuFD1UptUsVAnlg4WUAdY4TP GHpfLRaUWWb2W1Y0H0y7/H8GvJnLq8/fCaHy1gzKkc82L5ab7QfBdxoQx8YzX8PDLZjR T/ndEtAD9HnDp/f5u+4Vvm44Xged8azGWTToNtOq1LnmbygDic8+XKCT57tY4uw7yRGK H+iMeAF8ndjatpltWJFniwv40BTrui2otGdkfTw3h+tEx9ihVywEwiRIXY6IoDTNURNp ct/A== X-Gm-Message-State: AOAM5316PANas1UNBauAEJqAZKZEws7E5klI9tKqJbUP8eCeoUo0w/Io WogHTq8NuVEoih9llFr0Gkcpn4PcB70TUQ== X-Google-Smtp-Source: ABdhPJwUMdRVoiCCw4IgHm0BrB4szHbtZRGQTW01Gq1xvY6rveuYxsGFu3dO+VylYC6+/kNUNY15kA== X-Received: by 2002:a2e:a167:: with SMTP id u7mr1422396ljl.95.1607536710426; Wed, 09 Dec 2020 09:58:30 -0800 (PST) Received: from mail-lj1-f169.google.com (mail-lj1-f169.google.com. [209.85.208.169]) by smtp.gmail.com with ESMTPSA id y26sm311079ljm.33.2020.12.09.09.58.29 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 09 Dec 2020 09:58:29 -0800 (PST) Received: by mail-lj1-f169.google.com with SMTP id b10so1123199ljp.6 for ; Wed, 09 Dec 2020 09:58:29 -0800 (PST) X-Received: by 2002:a2e:5750:: with SMTP id r16mr1446782ljd.61.1607536708800; Wed, 09 Dec 2020 09:58:28 -0800 (PST) MIME-Version: 1.0 References: <20201209163950.8494-1-will@kernel.org> <20201209163950.8494-2-will@kernel.org> In-Reply-To: <20201209163950.8494-2-will@kernel.org> From: Linus Torvalds Date: Wed, 9 Dec 2020 09:58:12 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 1/2] mm: Allow architectures to request 'old' entries when prefaulting To: Will Deacon X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201209_125832_621753_7A2E467E X-CRM114-Status: GOOD ( 16.33 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jan Kara , Minchan Kim , Catalin Marinas , Linux Kernel Mailing List , Linux-MM , Vinayak Menon , "Kirill A . Shutemov" , Andrew Morton , Android Kernel Team , Linux ARM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Dec 9, 2020 at 8:40 AM Will Deacon wrote: > > @@ -3978,8 +3994,17 @@ static vm_fault_t do_fault_around(struct vm_fault *vmf) > > /* check if the page fault is solved */ > vmf->pte -= (vmf->address >> PAGE_SHIFT) - (address >> PAGE_SHIFT); > - if (!pte_none(*vmf->pte)) > - ret = VM_FAULT_NOPAGE; > + if (pte_none(*vmf->pte)) > + goto out_unlock; > + > + if (vmf->flags & FAULT_FLAG_PREFAULT_OLD) { > + pte_t pte = pte_mkyoung(*vmf->pte); > + if (ptep_set_access_flags(vmf->vma, address, vmf->pte, pte, 0)) > + update_mmu_cache(vmf->vma, address, vmf->pte); > + } Oh, please dear God no. First you incorrectly set it old, and then you conditionally make it young again and as a result force an atomic rwm update and another TLB flush for no good reason. Just make sure that the FAULT_FLAG_PREFAULT_OLD never sets the *actual* address to old. And yes, that probably means that you need to change "alloc_set_pte()" to actually pass in the real address, and leave "vmf->address" alone - so that it can know which ones are prefaulted and which one is real, but that sounds like a good idea anyway. Then you can just make alloc_set_pte() do the right thing in the first place, instead of doing this nasty "lets do it wrong and fix it up later" horror. Linus _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel