Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp1755132ybg; Sat, 19 Oct 2019 01:49:36 -0700 (PDT) X-Google-Smtp-Source: APXvYqxYANiLw3K0NQwhSyKaBF84tNiJJM7SW1waYlmW30jtjLitbov0ED8utSC5WJsf1ga0Hmvs X-Received: by 2002:a17:907:2172:: with SMTP id rl18mr12631107ejb.125.1571474976827; Sat, 19 Oct 2019 01:49:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571474976; cv=none; d=google.com; s=arc-20160816; b=dHXpTClO7W9GG/SOoyUTl9gtDcBRjv/PdHNNVwWKqdiuQWodrjDWUkbc3/wqJZw2FY piK6ZVEJZTQAcWbt88v0iEE0f1c3iDZrrPQ77h7SbX+3DzQc4Q2MiXg3lC1CZNKVQDfK BgQPYoUfbPpdX+VOCMRhwVg2gZC6H6JDE4GVbyHr3w4uY6fwpA2pMJGpEpKBBnKhsCUY kMxxPvm8Pw6pAf+gLGt3JnAs6A6/Fe5z3oOErjAkreYk57wMKAmu+eF6uv4cNtpB6D8r 0AKOmyvzEmRYG5xQ7Q0/seWtzH+jqPx5h+9CeViD0kDY+Q8LI8BHdMokn+uT/aaINPiK WFUA== 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=Fk5TkOpRTpvTPvIhw+jhlH/EWYQ8SCFWPxmF3GrKXeU=; b=Px2ztHQhoIhqOoMkfsF6p0F2CFiw4nQKM0cSkgiuLFu+3H0vW1NTT6F4UhVBuNETw/ AN18V6uPyTdqfppRgIePZaidah7pnP55aXGI3mQe2VgCkBt8dzDrci2VLPxYZZxlTKMS r77J5EN2hkSNASCPecU1vqqqb2hc14I6AOQwyF8d9HzcBgOaBQpRL6j19f75VGkmOuLh prkAlb2MX3Jdjtanty0hoT2xwswsxIylbymxvvUn0kFOcpLv78JElAMy/HLCK+Kl4gYL OigVv8U54NGVTkiU9v6EvuerVLLFIKYLnbSFW+aKkoit1rLZ5SKsGBcOckiw7+qGF4XO E05A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=ped4rrJo; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y8si5547344edd.355.2019.10.19.01.49.13; Sat, 19 Oct 2019 01:49:36 -0700 (PDT) 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=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=ped4rrJo; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2633429AbfJRQtt (ORCPT + 99 others); Fri, 18 Oct 2019 12:49:49 -0400 Received: from mail-pf1-f195.google.com ([209.85.210.195]:41651 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2437269AbfJRQtr (ORCPT ); Fri, 18 Oct 2019 12:49:47 -0400 Received: by mail-pf1-f195.google.com with SMTP id q7so4229257pfh.8 for ; Fri, 18 Oct 2019 09:49:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=Fk5TkOpRTpvTPvIhw+jhlH/EWYQ8SCFWPxmF3GrKXeU=; b=ped4rrJomSO8Qcd+AsAMZA070NAYHWro7VtIKJuL9kgSqKl/bjXvFmpIJGE+GbioWu KuDeNNAkDwi9w5N50nVaR08kMiP11Nu+jKWWqtcTHKKo1X03N3iP7L9NNy9p1j6ori5Y 8E3a+TgNF4HIaBlwLWgOl+mZg4mzfvuJq+BDzUDc+XTK9DIBnXv+o7lvmPoQIBkvW5pk UFnYHPWDqeoXf1abjMPdqglUBJeL7VPQXxex0TGM4sgbIgatSyUjEdhuemM7bTsGDqWR TxXCq0/BvwqWM1HmnVe4wz9K2N29lO7r1wVVC07/hc9cIil6wLqiZuQhcLhbLKff7nig GI1A== 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=Fk5TkOpRTpvTPvIhw+jhlH/EWYQ8SCFWPxmF3GrKXeU=; b=lAqG9O7YJnz5kapaoKK4WmuY+9UDC7DXXaV1/dIE7FUgQ3TmLdwvIWwtTZwFHPjFjM Bkxi0k+pcwyVH6Q2GdQPAdU3vCDGyChwUo3Tn5CMoAw1GZBC030bKmpzKN8R0x7nUdeb 1zORFSZOFV5p0t0Vxjfc/dSXVNAoo7eSA2BKPfJh9wined9CK9zURxcW7/igzAPJJZ1R 0D3iNe3KIsbnrrnyuMV66Dx8YYf1MqJDrI0ZJjY9FG3zgmiOMXnCrOk6PtOGai4lIvt1 hjav871lM68HUFOySi14PpENzWSseLQ4u26uI7O8eir1epJj0nZj6E0VfkSvBtPQQkfQ xDyw== X-Gm-Message-State: APjAAAW6xeCJZdP8mT4aJp/gCdMg8q0FgL1HirtN/E+6NRMMjxtpWcRT 7ayFa64xd9ZAx6IGyAAyrty/IQ== X-Received: by 2002:a63:394:: with SMTP id 142mr11150477pgd.375.1571417385868; Fri, 18 Oct 2019 09:49:45 -0700 (PDT) Received: from localhost ([2620:10d:c090:180::ac1a]) by smtp.gmail.com with ESMTPSA id v9sm6691727pfe.109.2019.10.18.09.49.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Oct 2019 09:49:45 -0700 (PDT) Date: Fri, 18 Oct 2019 12:49:43 -0400 From: Johannes Weiner To: Song Liu Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, akpm@linux-foundation.org, matthew.wilcox@oracle.com, kernel-team@fb.com, william.kucharski@oracle.com, kirill.shutemov@linux.intel.com, Hugh Dickins Subject: Re: [PATCH v2] mm,thp: recheck each page before collapsing file THP Message-ID: <20191018164943.GA179426@cmpxchg.org> References: <20191018163754.3736610-1-songliubraving@fb.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191018163754.3736610-1-songliubraving@fb.com> User-Agent: Mutt/1.12.2 (2019-09-21) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Oct 18, 2019 at 09:37:54AM -0700, Song Liu wrote: > In collapse_file(), after locking the page, it is necessary to recheck > that the page is up-to-date. Add PageUptodate() check for both shmem THP > and file THP. > > Current khugepaged should not try to collapse dirty file THP, because it > is limited to read only text. Add a PageDirty check and warning for file > THP. This is added after page_mapping() check, because if the page is > truncated, it might be dirty. > > Fixes: 99cb0dbd47a1 ("mm,thp: add read-only THP support for (non-shmem) FS") > Cc: Kirill A. Shutemov > Cc: Johannes Weiner > Cc: Hugh Dickins > Cc: William Kucharski > Cc: Andrew Morton > Signed-off-by: Song Liu Acked-by: Johannes Weiner