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=-3.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=no 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 46499C4361B for ; Thu, 17 Dec 2020 10:54:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 02A912389B for ; Thu, 17 Dec 2020 10:54:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727794AbgLQKyu (ORCPT ); Thu, 17 Dec 2020 05:54:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59514 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726983AbgLQKyt (ORCPT ); Thu, 17 Dec 2020 05:54:49 -0500 Received: from mail-lf1-x133.google.com (mail-lf1-x133.google.com [IPv6:2a00:1450:4864:20::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 34DCBC061794 for ; Thu, 17 Dec 2020 02:54:09 -0800 (PST) Received: by mail-lf1-x133.google.com with SMTP id o19so30597163lfo.1 for ; Thu, 17 Dec 2020 02:54:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shutemov-name.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=U2gdYWgfYq7/caNuHmA4slgJYp3VoGcO5t/XEQGLQQ0=; b=Y0vnIunm2BtL/nDigBSGNBcw/P80MeXJ3EktmUtjqwbdQoeIMih/9ec50Y2mgdyVGb YicrV8G2h8AV7KYlpscj68yN6nUzW0bmrl0gG0ZpUfAycLNiq46+sz0B8r1KAYx1PDq7 dw4YSLjL7JryxLo9VaWuFT+c+e6kqeKEUeiXQ/vTD6qRGPK+35YudpfKB0RIuykYkhIM 1r5hDiInL8OOBEMkGwmVjtF3UzBhSIeglXR/Yq6g8C/3CZj+I0mq939SwuzDEGrjza8W ffCRQAIVjRM5g1L2nolpR+H5YxTTI6hKuFwtw3oUmloGhOGPHj/qJ9CL7h9enpMfNt+q IMqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=U2gdYWgfYq7/caNuHmA4slgJYp3VoGcO5t/XEQGLQQ0=; b=ZIKFEQ2JQQtQGnPtNi+u2EEGbQOyo+L7VODfu1itC/WHGn6YXxtidx5l8FCsCgVBb7 4iwEiCtCqfbOtOcfsWMuG4Z+SE83HBSVNLKAb38ate9MZywE4WL/FcOgtK8H1gdhWVvr OIRRbafTIdqDDYHCk0P82A5iIj3vA+iLTUhvOT7/L8bHjtQCFEYQz802s+0gFW/0U6UI D1yx0BHQWIST8W3GEQNO+CuSanjwbKHitKXYjeeH+Pd1Et4/4yIzzLFalDjr8zXNb5Ny 6v3ir7PbtL5ydVv7QlszPUOP6quR3pt2nqzvSi/cOpdq/E3lM9/2BgHfHLTEL4EqoE2U tXJQ== X-Gm-Message-State: AOAM531Ydy96+csall64opTL6Mugs74QYY80YBhx3AIw4dfXRNAGQSxI Zn/MYVszGhXJJ5f6Y23RzvvKdQ== X-Google-Smtp-Source: ABdhPJw5YnXWpK4XOuli92QD7Gp3bI1r5jX1GrLIR/ZzJhjBrvbLIp9dNy4FbuDSBpMT+m8YLfK+2Q== X-Received: by 2002:a2e:918f:: with SMTP id f15mr8283125ljg.82.1608202447739; Thu, 17 Dec 2020 02:54:07 -0800 (PST) Received: from box.localdomain ([86.57.175.117]) by smtp.gmail.com with ESMTPSA id j1sm545204lfg.225.2020.12.17.02.54.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Dec 2020 02:54:07 -0800 (PST) Received: by box.localdomain (Postfix, from userid 1000) id 011E31033F4; Thu, 17 Dec 2020 13:54:09 +0300 (+03) Date: Thu, 17 Dec 2020 13:54:09 +0300 From: "Kirill A. Shutemov" To: Linus Torvalds 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 Subject: Re: [PATCH 1/2] mm: Allow architectures to request 'old' entries when prefaulting Message-ID: <20201217105409.2gacwgg7rco2ft3m@box> References: <20201209163950.8494-2-will@kernel.org> <20201209184049.GA8778@willie-the-truck> <20201210150828.4b7pg5lx666r7l2u@black.fi.intel.com> <20201214160724.ewhjqoi32chheone@box> <20201216170703.o5lpsnjfmoj7f3ml@box> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Dec 16, 2020 at 10:41:36AM -0800, Linus Torvalds wrote: > On Wed, Dec 16, 2020 at 9:07 AM Kirill A. Shutemov wrote: > > > > If this looks fine, I'll submit a proper patch. > > That patch looks good to me. > > It would be good if somebody else looked it through - maybe I like it > just because I got to pee in the snow and make my mark. But i think > that filemap_map_pages() now looks a lot more understandable, and > having that pte_offset_map_lock() outside the loop should be good. It worth noting that after the change in the worth case scenario we will have additional ref/unref and lock/unlock of the page if we get deep enough into filemap_map_pmd(), but fail to map the page. Also if the range doesn't have a mappable page we would setup a page table into the PMD entry. It means we cannot have huge page mapped there later. It may be a bummer: getting the page table out of page table tree requires mmap_write_lock(). We also take ptl for cold page cache. It may increase ptl contention, but it should be negligible with split-ptl. -- Kirill A. Shutemov 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=-3.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no 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 0AE11C2BBD5 for ; Thu, 17 Dec 2020 10:55:28 +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 A4DE52389B for ; Thu, 17 Dec 2020 10:55:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A4DE52389B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=shutemov.name 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:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=9jvb5b/usoXB35DD86B94LcMnpF4Eo0rjDmvQMnmFUs=; b=X+O+508spq0yqfKdxFH7bh6p2 3FssCha88Z9Zc1ql6lBL/CFWPomeg67/x4eP7No8q0vKgtgWKO8Dw4GX+zY1CLHoXKjySYsyAEHpy 5LuGYFWCHJr+ecVgLXJRZxVkNiU7DIeZBY+dRObzTNKbi82m/abiCCgunTklyD0sYtIeNbdB44+zA ZTrG4jOt1+8Yj8irGFmMFhSwXNVZL80r9IDO+VcNCIQiGlQztkF9LL/Phk6Sw9JUlVhyrpfwpMgLq tOyiCzlUcelr1uKWUDK/dw9/sxjMt2E+oIZSsVGIs73hs05aOvbCFOiw3957iUp3ZxwN5SNexz0TC pV9Yw5lwQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kpqvF-0004eH-SP; Thu, 17 Dec 2020 10:54:13 +0000 Received: from mail-lf1-x130.google.com ([2a00:1450:4864:20::130]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kpqvB-0004cN-6F for linux-arm-kernel@lists.infradead.org; Thu, 17 Dec 2020 10:54:11 +0000 Received: by mail-lf1-x130.google.com with SMTP id l11so56252872lfg.0 for ; Thu, 17 Dec 2020 02:54:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shutemov-name.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=U2gdYWgfYq7/caNuHmA4slgJYp3VoGcO5t/XEQGLQQ0=; b=Y0vnIunm2BtL/nDigBSGNBcw/P80MeXJ3EktmUtjqwbdQoeIMih/9ec50Y2mgdyVGb YicrV8G2h8AV7KYlpscj68yN6nUzW0bmrl0gG0ZpUfAycLNiq46+sz0B8r1KAYx1PDq7 dw4YSLjL7JryxLo9VaWuFT+c+e6kqeKEUeiXQ/vTD6qRGPK+35YudpfKB0RIuykYkhIM 1r5hDiInL8OOBEMkGwmVjtF3UzBhSIeglXR/Yq6g8C/3CZj+I0mq939SwuzDEGrjza8W ffCRQAIVjRM5g1L2nolpR+H5YxTTI6hKuFwtw3oUmloGhOGPHj/qJ9CL7h9enpMfNt+q IMqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=U2gdYWgfYq7/caNuHmA4slgJYp3VoGcO5t/XEQGLQQ0=; b=fbHcR2eCI4tL+SkEe3JPNDHjRzKb55MOIm5euTuf94TeUbQSCQvUZ5pjqTzXBJuVlk vYlRorzn6J//iKJnTD1uGabmF5dW3uncTeyBLbEK6m4w2u/MXtC3sesdwxbdMFxdLoML BBXoAZF6NzC9qC4+75uNhMO3HsklaEJLFwNLj8AHqjdOH+c8e1v2iwGfnwbl51kJvHVr 76ZaZJ7opo6BwZEUd5cXVkraLPvfNSfq1rMtCvMZ0nhU2mpG4SRL676c4vg0lG4l7eW1 9DOVb/ax1ySkIt71rrwZMpqAK3QI/SGN8J0yVIQ6MJ/sesUI7054jd9dDhfAkNLIvmsA 2ZOQ== X-Gm-Message-State: AOAM531HCSnlS24Ny9fekHp1oxkXDCTnj+y74vkEnQBB1e8Vj9BzSPVC EcvXd8agogT/pzSuvcZ0lF+jUg== X-Google-Smtp-Source: ABdhPJw5YnXWpK4XOuli92QD7Gp3bI1r5jX1GrLIR/ZzJhjBrvbLIp9dNy4FbuDSBpMT+m8YLfK+2Q== X-Received: by 2002:a2e:918f:: with SMTP id f15mr8283125ljg.82.1608202447739; Thu, 17 Dec 2020 02:54:07 -0800 (PST) Received: from box.localdomain ([86.57.175.117]) by smtp.gmail.com with ESMTPSA id j1sm545204lfg.225.2020.12.17.02.54.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Dec 2020 02:54:07 -0800 (PST) Received: by box.localdomain (Postfix, from userid 1000) id 011E31033F4; Thu, 17 Dec 2020 13:54:09 +0300 (+03) Date: Thu, 17 Dec 2020 13:54:09 +0300 From: "Kirill A. Shutemov" To: Linus Torvalds Subject: Re: [PATCH 1/2] mm: Allow architectures to request 'old' entries when prefaulting Message-ID: <20201217105409.2gacwgg7rco2ft3m@box> References: <20201209163950.8494-2-will@kernel.org> <20201209184049.GA8778@willie-the-truck> <20201210150828.4b7pg5lx666r7l2u@black.fi.intel.com> <20201214160724.ewhjqoi32chheone@box> <20201216170703.o5lpsnjfmoj7f3ml@box> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201217_055409_338415_9C0841C2 X-CRM114-Status: GOOD ( 18.60 ) 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 Wed, Dec 16, 2020 at 10:41:36AM -0800, Linus Torvalds wrote: > On Wed, Dec 16, 2020 at 9:07 AM Kirill A. Shutemov wrote: > > > > If this looks fine, I'll submit a proper patch. > > That patch looks good to me. > > It would be good if somebody else looked it through - maybe I like it > just because I got to pee in the snow and make my mark. But i think > that filemap_map_pages() now looks a lot more understandable, and > having that pte_offset_map_lock() outside the loop should be good. It worth noting that after the change in the worth case scenario we will have additional ref/unref and lock/unlock of the page if we get deep enough into filemap_map_pmd(), but fail to map the page. Also if the range doesn't have a mappable page we would setup a page table into the PMD entry. It means we cannot have huge page mapped there later. It may be a bummer: getting the page table out of page table tree requires mmap_write_lock(). We also take ptl for cold page cache. It may increase ptl contention, but it should be negligible with split-ptl. -- Kirill A. Shutemov _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel