Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp141631pxp; Fri, 18 Mar 2022 21:03:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxozo/CnrvVDgZi0QCmsZZjs7qHsBbqyD2jKFaHJ9QwXcaHjyCfIqVRCI/hJVdY+D0vJHDx X-Received: by 2002:a05:6402:187:b0:415:c784:abe0 with SMTP id r7-20020a056402018700b00415c784abe0mr12884493edv.168.1647662612031; Fri, 18 Mar 2022 21:03:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647662612; cv=none; d=google.com; s=arc-20160816; b=qL7LCyS8ZoLCePADhnI8bzFbzrY5lW89KQflS+blr57/H7R7xon8dxZxXfbJDf0Orl sXM3pYbfrMh4q/J1eJzV6gbhyUCDIOgirxvFW6MffYnqmjl7mdgfvy1yT94QjckToSvD WuVX1+NrrwQDBuWahdNxZ7TH/kw48jPb/jJEEyTFYLfFPMzYS4UUMjZsGc3AI1b704FI 2R6Nc211qW98nvRXkGe0b85TLw9DjeZK36ecnxaly5AzKv8R/sxfX6TFHBYVxXTxlizx SK+J09coSH86Bbvk9P7ogAH1a8aanV4j9pKTnhGMhiR1lPLL3+LYidue9KZZgSWxPgHG ey0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=DELhSJBPZGfDBsWOFD3hh/9WKqk4TqD5Ijyu+KpKTXo=; b=OlmjzG51huL6iVJChiJnV/vChO4QLiarJT6aA+KaW297W/JNtoK9kx7ufkq2OgJnrt aG0vDHSo8KK5ArZL2SmA+d/yFHxtgs0k4hs38qwbOQB68eLmg0KNopDL9saL3yu8eJt1 jfvJNATVdEpJhXTQnxWug4nu8TnQSO8LK31lhnFNlRlBzrdvVxQkJHl2hhmtGVbpxJsn M4aoWHcwtOUBryrZuDJCIM1M1rptynU04fYuN4O6NyrnCloNUwI4KzhXZoozPNWGK8KI 8KMGpbaOar9iLLbLGJRLc33FDWEExBA0mxlZiIYBKDpjqysz18tj6u5qBG5En2w2Z2jz Ch/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b="n2J/zIER"; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u5-20020a170906108500b006df76385bdasi2623390eju.122.2022.03.18.21.02.41; Fri, 18 Mar 2022 21:03:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b="n2J/zIER"; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239931AbiCRSuD (ORCPT + 99 others); Fri, 18 Mar 2022 14:50:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49822 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239083AbiCRSuC (ORCPT ); Fri, 18 Mar 2022 14:50:02 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 72163220FC; Fri, 18 Mar 2022 11:48:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=DELhSJBPZGfDBsWOFD3hh/9WKqk4TqD5Ijyu+KpKTXo=; b=n2J/zIERaaXYlpHf3zgcUq7dVQ fRQDMCLt3OOvI6c3+1cZL8tLSZnMum46u3H6dVQ+bTfDnc1f+LdOSYur9428k52HcB1aRersuyd85 HN/AGurfzwqNzYlC+Iig/gMAQhKHuqUXMGm8ckmmj+ZvpIZ20Z/C8TP1gqQBXokhygwtm1jvmEQiV +VaHe+JoZZiIIk8ACUQgxFBWRkr0SbTox2eZb8yhmuNZc/yEhLHDHTDqMk0xA/I/quP/puvy68VmX zJ8Upi26DD7IxyonDfdGj63fdLsavSotncQXimFfKl+Hq/xeZQBm1dLPfoTN4u7isMg2BNkKv8ctd 3bkwU46Q==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nVHds-008CVS-SX; Fri, 18 Mar 2022 18:48:04 +0000 Date: Fri, 18 Mar 2022 18:48:04 +0000 From: Matthew Wilcox To: Yang Shi Cc: Dave Chinner , vbabka@suse.cz, kirill.shutemov@linux.intel.com, linmiaohe@huawei.com, songliubraving@fb.com, riel@surriel.com, ziy@nvidia.com, akpm@linux-foundation.org, tytso@mit.edu, adilger.kernel@dilger.ca, darrick.wong@oracle.com, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org, linux-xfs@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [v2 PATCH 0/8] Make khugepaged collapse readonly FS THP more consistent Message-ID: References: <20220317234827.447799-1-shy828301@gmail.com> <20220318012948.GE1544202@dread.disaster.area> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Fri, Mar 18, 2022 at 11:04:29AM -0700, Yang Shi wrote: > I agree once page cache huge page is fully supported, > READ_ONLY_THP_FOR_FS could be deprecated. But actually this patchset > makes khugepaged collapse file THP more consistently. It guarantees > the THP could be collapsed as long as file THP is supported and > configured properly and there is suitable file vmas, it is not > guaranteed by the current code. So it should be useful even though > READ_ONLY_THP_FOR_FS is gone IMHO. I don't know if it's a good thing or not. Experiments with 64k PAGE_SIZE on arm64 shows some benchmarks improving and others regressing. Just because we _can_ collapse a 2MB range of pages into a single 2MB page doesn't mean we _should_. I suspect the right size folio for any given file will depend on the access pattern. For example, dirtying a few bytes in a folio will result in the entire folio being written back. Is that what you want? Maybe! It may prompt the filesystem to defragment that range, which would be good. On the other hand, if you're bandwidth limited, it may decrease your performance. And if your media has limited write endurance, it may result in your drive wearing out more quickly. Changing the heuristics should come with data. Preferably from a wide range of systems and use cases. I know that's hard to do, but how else can we proceed? And I think you ignored my point that READ_ONLY_THP_FOR_FS required no changes to filesystems. It was completely invisible to them, by design. Now this patchset requires each filesystem to do something. That's not a great step. P.S. khugepaged currently does nothing if a range contains a compound page. It assumes that the page is compound because it's now a THP. Large folios break that assumption, so khugepaged will now never collapse a range which includes large folios. Thanks to commit mm/filemap: Support VM_HUGEPAGE for file mappings we'll always try to bring in PMD-sized pages for MADV_HUGEPAGE, so it _probably_ doesn't matter. But it's something we should watch for as filesystems grow support for large folios.