Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp856670imu; Tue, 20 Nov 2018 08:01:03 -0800 (PST) X-Google-Smtp-Source: AFSGD/XgfadsejpjN9EUtWvZify63sO9/YBPLsAlCeHW8TsTtX/vbGRH2gb9hPEAjw8y5XBzIm/U X-Received: by 2002:a63:f547:: with SMTP id e7mr2464477pgk.182.1542729662247; Tue, 20 Nov 2018 08:01:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542729662; cv=none; d=google.com; s=arc-20160816; b=wJ3Wn7GWKaV2fBaouKDID8fd4ItqPVp2Nwc3tz9EhjHc9dl9xAE18huwoQRkLDXuqJ Mk+J9Lh/GH/8+dlydNUOLJeWUeR9+bkzCvrDzreLzg0M0C9PrLKvkdzrvZeW7FzqDtZP fo8/Dyz3uSQwsIy83NmJNlkw3foOif9wOVTr9GgKVnTZR1IUekptd5bPtOZrUQ7vx+x0 NXR5B477L76Xg1vqe5T7GZjo6Q8ctKyssoKC1UD8gwTlrI0aJSkaFmGUnfvn6XF+aeam 0AlACCHglsuUG6gqIzMmnqwuZlKiLNKYSSL+/8Gk+UNBjr/mO0nVe55is/s9HVT1lycC Fz7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=WtSfedqgA3D4cYf3BEfvJf2SYBcycZEfPER9XYqbV5c=; b=aYdOV+kyyTmI7Me6Aqtw1z2nzv4UUOSgtRjZqabgKQMHRgDQ2D/7mjeOQFXOFdOvQ3 EGzED+HNQzK86bYKA3U1+JsVdEFrkqmMMVaS4KnvGV94VLsKS+p3Dav2vu6JJEeZdWpA W//YKIQzKUL/hehU73iHDB+eE8B7TmRuR4aNozyZ92L9AUyMmujjbKpbPIgDXpMaEOwG NJmeXn36Pf/S2w9mZceOco2hEr91AaBjfD0coBrFvV1d6hQWymd12YQ+flsK+jfekYjw qMkWBMLP4NIs6fslRl2VQu5HqyoV/dlGo0xOUxwIez7P6tDG/36S/R3XshN2aG+/VP+0 b40Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@shutemov-name.20150623.gappssmtp.com header.s=20150623 header.b=nIS7eySy; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e6si35287021pgd.428.2018.11.20.08.00.46; Tue, 20 Nov 2018 08:01:02 -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; dkim=pass header.i=@shutemov-name.20150623.gappssmtp.com header.s=20150623 header.b=nIS7eySy; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729608AbeKUAq1 (ORCPT + 99 others); Tue, 20 Nov 2018 19:46:27 -0500 Received: from mail-pf1-f196.google.com ([209.85.210.196]:44914 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726254AbeKUAq1 (ORCPT ); Tue, 20 Nov 2018 19:46:27 -0500 Received: by mail-pf1-f196.google.com with SMTP id u6so1053118pfh.11 for ; Tue, 20 Nov 2018 06:17:06 -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:user-agent; bh=WtSfedqgA3D4cYf3BEfvJf2SYBcycZEfPER9XYqbV5c=; b=nIS7eySyj57zWdEsY8suKs1PWdALqlrD+Ec2W+2Lva+Wxu2v1/YWBDfDOg6vPOua/5 lzZruu1uRw4FW5XuvINAH/pUHF2sZnLvqyE9o5xYVVtIWwiA6JV1wjPpMIlF14+0pbf4 gVYAsvgPYvsi0kXOj1wnpQzAE3QhPOxytIHNAiZW+UEAyx4GYFSuFUd4PU8SHZto78kY DRwekK3cTqeGwt+HmhinRarndUlwCKp5pc5AomqXwnpmTJGOkLn2XMZIhSRTKvE2j4Ut 5Yj1wAAUz/FgQ+2az5S4fjAArgvUjfk6qGvvFVDFFxtivL9nE1XJ/rOtFkEqwPQ1r/cA Hkog== 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:user-agent; bh=WtSfedqgA3D4cYf3BEfvJf2SYBcycZEfPER9XYqbV5c=; b=s1TsIFVg4vk5Py9zL8Vf1bdFfqPFneBZBOqxY2MOwyoN5tTAVzIM+2MCBaJWqIr1hy 14TRS5WTFfuYCHmRr6BH5pXhksbz/kndB8hSDMwIpzlA/hmkZhITvCdCM/wY0Bo7qRVO G+Vs4/q5DABzp8DyEJeSPXYl+vL3PQbzIJDg/01ozcTYqQ+DeqaX+HnJjtHiTuGTt3eZ 8+byvJCeclzmAZwEoHPDfj1x7I5fPWxgfRqixfqXnBDPlmdjPNM9KJgYBgFZbyzRsrYu m/HJGqiFpvUlZ9OWBrG2GPYI4jv+Dvktzb8hm45tZ9OdnVFpecmPwGk9YZROV0huh6Jb eT6Q== X-Gm-Message-State: AGRZ1gKfGVpGquGcUnGRIjUeK+R3lWxUad4VH83tV5w2GzRnmX0BR+aV 6+yT/emLh91W8RGP7h/4UDEHbg== X-Received: by 2002:a62:2606:: with SMTP id m6mr2278092pfm.133.1542723425436; Tue, 20 Nov 2018 06:17:05 -0800 (PST) Received: from kshutemo-mobl1.localdomain (fmdmzpr04-ext.fm.intel.com. [192.55.54.39]) by smtp.gmail.com with ESMTPSA id t2sm29708521pfm.32.2018.11.20.06.17.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 20 Nov 2018 06:17:04 -0800 (PST) Received: by kshutemo-mobl1.localdomain (Postfix, from userid 1000) id E2C96302653; Tue, 20 Nov 2018 17:17:00 +0300 (+03) Date: Tue, 20 Nov 2018 17:17:00 +0300 From: "Kirill A. Shutemov" To: Michal Hocko Cc: linux-mm@kvack.org, Andrew Morton , Oscar Salvador , Pavel Tatashin , David Hildenbrand , LKML Subject: Re: [RFC PATCH 3/3] mm, fault_around: do not take a reference to a locked page Message-ID: <20181120141700.pwoaxatx3v5xnwos@kshutemo-mobl1> References: <20181120134323.13007-1-mhocko@kernel.org> <20181120134323.13007-4-mhocko@kernel.org> <20181120140715.mouc7okin3ht5krr@kshutemo-mobl1> <20181120141207.GK22247@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181120141207.GK22247@dhcp22.suse.cz> User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Nov 20, 2018 at 03:12:07PM +0100, Michal Hocko wrote: > On Tue 20-11-18 17:07:15, Kirill A. Shutemov wrote: > > On Tue, Nov 20, 2018 at 02:43:23PM +0100, Michal Hocko wrote: > > > From: Michal Hocko > > > > > > filemap_map_pages takes a speculative reference to each page in the > > > range before it tries to lock that page. While this is correct it > > > also can influence page migration which will bail out when seeing > > > an elevated reference count. The faultaround code would bail on > > > seeing a locked page so we can pro-actively check the PageLocked > > > bit before page_cache_get_speculative and prevent from pointless > > > reference count churn. > > > > Looks fine to me. > > Thanks for the review. > > > But please drop a line of comment in the code. As is it might be confusing > > for a reader. > > This? Yep. Acked-by: Kirill A. Shutemov > > diff --git a/mm/filemap.c b/mm/filemap.c > index c76d6a251770..7c4e439a2e85 100644 > --- a/mm/filemap.c > +++ b/mm/filemap.c > @@ -2554,6 +2554,10 @@ void filemap_map_pages(struct vm_fault *vmf, > > head = compound_head(page); > > + /* > + * Check the locked pages before taking a reference to not > + * go in the way of migration. > + */ > if (PageLocked(head)) > goto next; > if (!page_cache_get_speculative(head)) > -- > Michal Hocko > SUSE Labs -- Kirill A. Shutemov