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,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 DD031C0018C for ; Sat, 19 Dec 2020 20:40:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9ABFA2389F for ; Sat, 19 Dec 2020 20:40:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727724AbgLSUks (ORCPT ); Sat, 19 Dec 2020 15:40:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54444 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726238AbgLSUkr (ORCPT ); Sat, 19 Dec 2020 15:40:47 -0500 Received: from mail-lf1-x135.google.com (mail-lf1-x135.google.com [IPv6:2a00:1450:4864:20::135]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8FDDEC0613CF for ; Sat, 19 Dec 2020 12:39:55 -0800 (PST) Received: by mail-lf1-x135.google.com with SMTP id o17so14426674lfg.4 for ; Sat, 19 Dec 2020 12:39:55 -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=i6WEkkm6ItmYR5Nc7WLcGl8iPUHvmHopSYUb1uCJQT0=; b=OyMepeYRv3SqqZn1639l0dapTnd3++utPvIHPn/lAKEKQz8ez3nMhl3LxHjUrjCAch bIwOnC79LDNLzECuWXDHNLtLFoZNVW9RT1K4iYWHcjnyQjwDShXfShciNOARkm4QAzWd rztJriJMwLJToBCHJ5xgY++4IZUL1rg5qu4qE= 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=i6WEkkm6ItmYR5Nc7WLcGl8iPUHvmHopSYUb1uCJQT0=; b=fYGMCFdIdjxFp4fQfW2Pl4aRE4p8VpJMTOvaXB+JR9QBa3yfPs7meAkf7661M4B2un NIQZfdb2LV10J3mgIUiNi1QwiR4A0D6zdHdbTurvsonRKJ/j6PSsy5clswSh0BDPX0aM w08pvJlKjUcs2a3JEugG2gsq5J69eHPHr9SHS1W8UCD6ACe+njziALLc4Dn4W08CnPqJ l0LUjvz+t6MeTq6Xb2+8JXhd5MGudy9uTkPnUseN2qY9BbAsjLocMZ7yXK0oMj5c0+nN YjNyV5rw6tXmpmObXafNHegw7eVUnWHKBiMxWUsS5cxCJNSdMMT+CJX3UxyWOpQveLEN 1Usw== X-Gm-Message-State: AOAM533eiGa2e27iZMkVA4DJs/CH1BVJ2xNevJXHdQ6wZQ+kQjEXHTWP 5FWffN0f2g2sTkI+JtZpcToHR/1cBsr4Dg== X-Google-Smtp-Source: ABdhPJyjkZfpgZOwIHQpw/SPP/bzOKHOp78sEzIULxWz4wxYMJltJnQmRn1HR1f2eVkW6b5XCPVg3w== X-Received: by 2002:a19:42c2:: with SMTP id p185mr1832061lfa.423.1608410393568; Sat, 19 Dec 2020 12:39:53 -0800 (PST) Received: from mail-lf1-f43.google.com (mail-lf1-f43.google.com. [209.85.167.43]) by smtp.gmail.com with ESMTPSA id j7sm1407537lfg.114.2020.12.19.12.39.53 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 19 Dec 2020 12:39:53 -0800 (PST) Received: by mail-lf1-f43.google.com with SMTP id l11so14475468lfg.0 for ; Sat, 19 Dec 2020 12:39:53 -0800 (PST) X-Received: by 2002:a2e:6f17:: with SMTP id k23mr4369075ljc.411.1608410073306; Sat, 19 Dec 2020 12:34:33 -0800 (PST) MIME-Version: 1.0 References: <20201210150828.4b7pg5lx666r7l2u@black.fi.intel.com> <20201214160724.ewhjqoi32chheone@box> <20201216170703.o5lpsnjfmoj7f3ml@box> <20201217105409.2gacwgg7rco2ft3m@box> <20201218110400.yve45r3zsv7qgfa3@box> <20201219124103.w6isern3ywc7xbur@box> In-Reply-To: <20201219124103.w6isern3ywc7xbur@box> From: Linus Torvalds Date: Sat, 19 Dec 2020 12:34:17 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 1/2] mm: Allow architectures to request 'old' entries when prefaulting To: "Kirill A. Shutemov" Cc: Matthew Wilcox , "Kirill A. Shutemov" , Will Deacon , Linux Kernel Mailing List , Linux-MM , Linux ARM , Catalin Marinas , Jan Kara , Minchan Kim , Andrew Morton , 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 Sat, Dec 19, 2020 at 4:41 AM Kirill A. Shutemov wrote: > > @@ -2884,19 +2966,18 @@ void filemap_map_pages(struct vm_fault *vmf, > if (vmf->pte) > vmf->pte += xas.xa_index - last_pgoff; > last_pgoff = xas.xa_index; > - if (alloc_set_pte(vmf, page)) > - goto unlock; > + if (pte_none(*vmf->pte)) > + do_set_pte(vmf, page); > + /* no need to invalidate: a not-present page won't be cached */ > + update_mmu_cache(vma, vmf->address, vmf->pte); > unlock_page(head); > - goto next; > + continue; This can't be right. Look at what happens if "pte_none()" is not true.. It won't install the new pte, but it also won't drop the ref to the page. So I think it needs to be - if (alloc_set_pte(vmf, page)) + if (!pte_none(*vmf->pte)) goto unlock; + do_set_pte(vmf, page); instead, so that the "if somebody else already filled the page table" case gets handled right. Hmm? 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 90E00C4361B for ; Sat, 19 Dec 2020 20:34:39 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 151AA2388E for ; Sat, 19 Dec 2020 20:34:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 151AA2388E 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 2F4346B005C; Sat, 19 Dec 2020 15:34:38 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 2A5DE6B005D; Sat, 19 Dec 2020 15:34:38 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1F11A6B0068; Sat, 19 Dec 2020 15:34:38 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0019.hostedemail.com [216.40.44.19]) by kanga.kvack.org (Postfix) with ESMTP id 05E216B005C for ; Sat, 19 Dec 2020 15:34:38 -0500 (EST) Received: from smtpin07.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id BEC0F8249980 for ; Sat, 19 Dec 2020 20:34:37 +0000 (UTC) X-FDA: 77611184994.07.road48_22025f127449 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin07.hostedemail.com (Postfix) with ESMTP id A75111803F900 for ; Sat, 19 Dec 2020 20:34:37 +0000 (UTC) X-HE-Tag: road48_22025f127449 X-Filterd-Recvd-Size: 5323 Received: from mail-lf1-f47.google.com (mail-lf1-f47.google.com [209.85.167.47]) by imf45.hostedemail.com (Postfix) with ESMTP for ; Sat, 19 Dec 2020 20:34:37 +0000 (UTC) Received: by mail-lf1-f47.google.com with SMTP id x20so14295218lfe.12 for ; Sat, 19 Dec 2020 12:34:36 -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=i6WEkkm6ItmYR5Nc7WLcGl8iPUHvmHopSYUb1uCJQT0=; b=OyMepeYRv3SqqZn1639l0dapTnd3++utPvIHPn/lAKEKQz8ez3nMhl3LxHjUrjCAch bIwOnC79LDNLzECuWXDHNLtLFoZNVW9RT1K4iYWHcjnyQjwDShXfShciNOARkm4QAzWd rztJriJMwLJToBCHJ5xgY++4IZUL1rg5qu4qE= 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=i6WEkkm6ItmYR5Nc7WLcGl8iPUHvmHopSYUb1uCJQT0=; b=T0VtDYtngUdCQoAK2cwyzlIVb/hzUNipOa75TOH8wk6fKS+DPKjxaBbQKmBCamu8f6 5yNo50A4KNauHkiF3qTCDFzTR7VBzttZLd8WZiUL4H1VhDJVNwMX9ajXO9XbOmRLI6EZ ErNR9z87vPo/wcOSyrZGAu21rKNNgO8h49EO2CmMgR89oJ/estODfyEuIVCD30qo/z5S Q9+PUon7+beWveJGQqsVsRjkHns4t2I2Zc9/v0egux9ype7F0avARVshN8IA9S3sH0yg Vd0liEgzHwrncn5SAF63TGNNatGfKGFATiEujpbjyim7Fln0TyS0b9kfHNVntVo0On47 xtIw== X-Gm-Message-State: AOAM533ZugepkB8HBGm9QlSgvXH/y1lw5P9+l4dnYqqD7OML8JJCKXX8 Z/70GP1fdrakjtjgy/R75PVvKEhI8UuRzg== X-Google-Smtp-Source: ABdhPJzigu2CbtAmiyFXsEzGJEYYFzQv7yQBbNPYneCnl3GX68SdfbvdzduRJUD0G7IPurPOnDUg7g== X-Received: by 2002:a2e:81cb:: with SMTP id s11mr4314227ljg.377.1608410074988; Sat, 19 Dec 2020 12:34:34 -0800 (PST) Received: from mail-lf1-f50.google.com (mail-lf1-f50.google.com. [209.85.167.50]) by smtp.gmail.com with ESMTPSA id y9sm1541544ljy.37.2020.12.19.12.34.33 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 19 Dec 2020 12:34:34 -0800 (PST) Received: by mail-lf1-f50.google.com with SMTP id o13so14408692lfr.3 for ; Sat, 19 Dec 2020 12:34:33 -0800 (PST) X-Received: by 2002:a2e:6f17:: with SMTP id k23mr4369075ljc.411.1608410073306; Sat, 19 Dec 2020 12:34:33 -0800 (PST) MIME-Version: 1.0 References: <20201210150828.4b7pg5lx666r7l2u@black.fi.intel.com> <20201214160724.ewhjqoi32chheone@box> <20201216170703.o5lpsnjfmoj7f3ml@box> <20201217105409.2gacwgg7rco2ft3m@box> <20201218110400.yve45r3zsv7qgfa3@box> <20201219124103.w6isern3ywc7xbur@box> In-Reply-To: <20201219124103.w6isern3ywc7xbur@box> From: Linus Torvalds Date: Sat, 19 Dec 2020 12:34:17 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 1/2] mm: Allow architectures to request 'old' entries when prefaulting To: "Kirill A. Shutemov" Cc: Matthew Wilcox , "Kirill A. Shutemov" , Will Deacon , Linux Kernel Mailing List , Linux-MM , Linux ARM , Catalin Marinas , Jan Kara , Minchan Kim , Andrew Morton , 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 Sat, Dec 19, 2020 at 4:41 AM Kirill A. Shutemov wrote: > > @@ -2884,19 +2966,18 @@ void filemap_map_pages(struct vm_fault *vmf, > if (vmf->pte) > vmf->pte += xas.xa_index - last_pgoff; > last_pgoff = xas.xa_index; > - if (alloc_set_pte(vmf, page)) > - goto unlock; > + if (pte_none(*vmf->pte)) > + do_set_pte(vmf, page); > + /* no need to invalidate: a not-present page won't be cached */ > + update_mmu_cache(vma, vmf->address, vmf->pte); > unlock_page(head); > - goto next; > + continue; This can't be right. Look at what happens if "pte_none()" is not true.. It won't install the new pte, but it also won't drop the ref to the page. So I think it needs to be - if (alloc_set_pte(vmf, page)) + if (!pte_none(*vmf->pte)) goto unlock; + do_set_pte(vmf, page); instead, so that the "if somebody else already filled the page table" case gets handled right. Hmm? 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 1A3C2C4361B for ; Sat, 19 Dec 2020 20:35:54 +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 C327F235FA for ; Sat, 19 Dec 2020 20:35:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C327F235FA 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=y1VlDm+smbQgVK7WR7NISJzrxMPXZ3oKU/Q5A5K27MA=; b=aqkQPP5DG3UNBX1CuMf5lH44z DaHnwrcTd9B1gTknsg8K/+aDvjM2qqniiuXFHPPz39ZcYNDDYyUvEqhotHxoysM75tObhyQ48ei0p JzECl4qf2wJENvdHdohUM7GSdqUPX+/0tzVBJdrYr0lL+aNITfC/7wIW5F2aVJiX8r0Ygby57AQ2i begM35YZloa/d2K0004z/hwCBCuCHtdp0EMP4Wf78tWCFPZxVvRQOXJzliriupqzJsmFXWuv3j9Cf 4MUgU2LH5Ezoiof7pNPHfnovJ4DhRSaQw6pwWfA0ii5oQolit5f+V6XrgGaGh+5IAyUwWebFUK2wf arKaMxDow==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kqiw4-0000fy-97; Sat, 19 Dec 2020 20:34:40 +0000 Received: from mail-lf1-x136.google.com ([2a00:1450:4864:20::136]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kqiw0-0000f0-Ub for linux-arm-kernel@lists.infradead.org; Sat, 19 Dec 2020 20:34:38 +0000 Received: by mail-lf1-x136.google.com with SMTP id y19so14257774lfa.13 for ; Sat, 19 Dec 2020 12:34:36 -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=i6WEkkm6ItmYR5Nc7WLcGl8iPUHvmHopSYUb1uCJQT0=; b=OyMepeYRv3SqqZn1639l0dapTnd3++utPvIHPn/lAKEKQz8ez3nMhl3LxHjUrjCAch bIwOnC79LDNLzECuWXDHNLtLFoZNVW9RT1K4iYWHcjnyQjwDShXfShciNOARkm4QAzWd rztJriJMwLJToBCHJ5xgY++4IZUL1rg5qu4qE= 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=i6WEkkm6ItmYR5Nc7WLcGl8iPUHvmHopSYUb1uCJQT0=; b=sLWuKizap7VYzFFruP/Df+X1ydUlGwLQxffaoF8j7bVzlmHkoxOkI4VdzfbTCeGBXz eAVFXvBuHFkhnmZR6jr2OW7ZAWHPWd+1MmLV1Y90yn3qwxBSt6DBWRKvKBSno2GpYxEg oD0Kj7NKbiULu6GNhPDIOgRi9mW70b3P2TdKc9o0DPNEUdLa0b4cXds/wSn57VaXJ2Zi 70ye09Lz5yiKmkCbtjgtEWOh4FJv1NNT5a+GYYxhB+5688x46IkoauhQ4YzczM8R11TN gLcKsAk04FUXI5n91cDoQAfwjuFtYWupSuZD9AEDeWooPhZ1BcaaWl+FgFtm7YTgQ5oD 2DMQ== X-Gm-Message-State: AOAM532AfCDXatJaRS3W/tU3D8OEhpX1aU8jlSoglTQnGQNW1JwHm/uv 11bL9PZxqhR+FK9GhKGSoRs+Ko6Qq8/MtA== X-Google-Smtp-Source: ABdhPJyT47R1A3Qc0D+FnI6aFUDcc4UlGXOA4exp3iBjOW/IR8NmBg1Gf31TbwuhvIKTNx65RojFtg== X-Received: by 2002:ac2:431a:: with SMTP id l26mr4018802lfh.196.1608410074910; Sat, 19 Dec 2020 12:34:34 -0800 (PST) Received: from mail-lf1-f46.google.com (mail-lf1-f46.google.com. [209.85.167.46]) by smtp.gmail.com with ESMTPSA id q15sm1543675ljh.136.2020.12.19.12.34.33 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 19 Dec 2020 12:34:34 -0800 (PST) Received: by mail-lf1-f46.google.com with SMTP id h205so14370634lfd.5 for ; Sat, 19 Dec 2020 12:34:33 -0800 (PST) X-Received: by 2002:a2e:6f17:: with SMTP id k23mr4369075ljc.411.1608410073306; Sat, 19 Dec 2020 12:34:33 -0800 (PST) MIME-Version: 1.0 References: <20201210150828.4b7pg5lx666r7l2u@black.fi.intel.com> <20201214160724.ewhjqoi32chheone@box> <20201216170703.o5lpsnjfmoj7f3ml@box> <20201217105409.2gacwgg7rco2ft3m@box> <20201218110400.yve45r3zsv7qgfa3@box> <20201219124103.w6isern3ywc7xbur@box> In-Reply-To: <20201219124103.w6isern3ywc7xbur@box> From: Linus Torvalds Date: Sat, 19 Dec 2020 12:34:17 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 1/2] mm: Allow architectures to request 'old' entries when prefaulting To: "Kirill A. Shutemov" X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201219_153437_299147_8F127271 X-CRM114-Status: GOOD ( 14.65 ) 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: Android Kernel Team , Jan Kara , Minchan Kim , Catalin Marinas , Linux Kernel Mailing List , Matthew Wilcox , Linux-MM , Vinayak Menon , "Kirill A. Shutemov" , Andrew Morton , Will Deacon , 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 Sat, Dec 19, 2020 at 4:41 AM Kirill A. Shutemov wrote: > > @@ -2884,19 +2966,18 @@ void filemap_map_pages(struct vm_fault *vmf, > if (vmf->pte) > vmf->pte += xas.xa_index - last_pgoff; > last_pgoff = xas.xa_index; > - if (alloc_set_pte(vmf, page)) > - goto unlock; > + if (pte_none(*vmf->pte)) > + do_set_pte(vmf, page); > + /* no need to invalidate: a not-present page won't be cached */ > + update_mmu_cache(vma, vmf->address, vmf->pte); > unlock_page(head); > - goto next; > + continue; This can't be right. Look at what happens if "pte_none()" is not true.. It won't install the new pte, but it also won't drop the ref to the page. So I think it needs to be - if (alloc_set_pte(vmf, page)) + if (!pte_none(*vmf->pte)) goto unlock; + do_set_pte(vmf, page); instead, so that the "if somebody else already filled the page table" case gets handled right. Hmm? Linus _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel