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