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.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS 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 2F908C2D0E4 for ; Tue, 17 Nov 2020 21:43:54 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id E9CF5241A7 for ; Tue, 17 Nov 2020 21:43:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="RXcEhCde" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E9CF5241A7 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 04B456B0036; Tue, 17 Nov 2020 16:43:52 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id F3E456B005C; Tue, 17 Nov 2020 16:43:51 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E05696B0068; Tue, 17 Nov 2020 16:43:51 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0036.hostedemail.com [216.40.44.36]) by kanga.kvack.org (Postfix) with ESMTP id B45D86B0036 for ; Tue, 17 Nov 2020 16:43:51 -0500 (EST) Received: from smtpin13.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 5ACCD181AEF21 for ; Tue, 17 Nov 2020 21:43:51 +0000 (UTC) X-FDA: 77495237862.13.tree37_030641027334 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin13.hostedemail.com (Postfix) with ESMTP id 3CD3618140B67 for ; Tue, 17 Nov 2020 21:43:51 +0000 (UTC) X-HE-Tag: tree37_030641027334 X-Filterd-Recvd-Size: 4912 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf13.hostedemail.com (Postfix) with ESMTP for ; Tue, 17 Nov 2020 21:43:50 +0000 (UTC) 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=U1HUq3odOaKKvpXhRq9sCZmlrJ8CUFhzjI0olhIffX8=; b=RXcEhCdel4HtJTqO+9ba2Ef8q0 4d+tTf7mLLmqyXSfW52Cr4E1EqvArs7Hl0JXOvpF75xQj2ruK7nQyvjknZr5VcctuMzsd7IRIFaKL 3glUIHYp+jOAJdEerRZqTMOmhdmHWZyksjxWYNQlqZ4hqoJLvW66dFj4L+UW4p9ZD4WpAqpw7PkJ5 3PPMWRcqa7FoKXBQQ56p6sUkfUb8E+mA0Y/CUlkLL1/ExDKtNu7+VIOuRs5RrjZ1koxL8OVSQKiNq h8Ag0VIKoZz3CcCD1msO5XY/FXnp3zOucGXJ+YNPsAeF8QNQ+W5LdKp8LvRhrPFs7b8iJQsh43bff k9FRW/Fw==; Received: from willy by casper.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1kf8lN-0005WN-V8; Tue, 17 Nov 2020 21:43:46 +0000 Date: Tue, 17 Nov 2020 21:43:45 +0000 From: Matthew Wilcox To: Roman Gushchin Cc: Zi Yan , linux-mm@kvack.org, "Kirill A . Shutemov" , Andrew Morton , linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, Yang Shi , Michal Hocko , John Hubbard , Ralph Campbell , David Nellans Subject: Re: [RFC PATCH 3/6] mm: page_owner: add support for splitting to any order in split page_owner. Message-ID: <20201117214345.GB29991@casper.infradead.org> References: <20201111204008.21332-1-zi.yan@sent.com> <20201111204008.21332-4-zi.yan@sent.com> <20201114001505.GA3047204@carbon.dhcp.thefacebook.com> <20201114013801.GA3069806@carbon.dhcp.thefacebook.com> <20201117210532.GX29991@casper.infradead.org> <3E32BC50-700F-471E-89FD-35414610B84E@nvidia.com> <20201117212255.GZ29991@casper.infradead.org> <20201117213537.GB156448@carbon.DHCP.thefacebook.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201117213537.GB156448@carbon.DHCP.thefacebook.com> X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Tue, Nov 17, 2020 at 01:35:37PM -0800, Roman Gushchin wrote: > On Tue, Nov 17, 2020 at 09:22:55PM +0000, Matthew Wilcox wrote: > > On Tue, Nov 17, 2020 at 04:12:03PM -0500, Zi Yan wrote: > > > On 17 Nov 2020, at 16:05, Matthew Wilcox wrote: > > > > > > > On Fri, Nov 13, 2020 at 05:38:01PM -0800, Roman Gushchin wrote: > > > >> On Fri, Nov 13, 2020 at 08:08:58PM -0500, Zi Yan wrote: > > > >>> Matthew recently converted split_page_owner to take nr instead of order.[1] > > > >>> But I am not > > > >>> sure why, since it seems to me that two call sites (__split_huge_page in > > > >>> mm/huge_memory.c and split_page in mm/page_alloc.c) can pass the order > > > >>> information. > > > >> > > > >> Yeah, I'm not sure why too. Maybe Matthew has some input here? > > > >> You can also pass new_nr, but IMO orders look so much better here. > > > > > > > > If only I'd written that information in the changelog ... oh wait, I did! > > > > > > > > mm/page_owner: change split_page_owner to take a count > > > > > > > > The implementation of split_page_owner() prefers a count rather than the > > > > old order of the page. When we support a variable size THP, we won't > > > > have the order at this point, but we will have the number of pages. > > > > So change the interface to what the caller and callee would prefer. > > > > > > There are two callers, split_page in mm/page_alloc.c and __split_huge_page in > > > mm/huge_memory.c. The former has the page order. The latter has the page order > > > information before __split_huge_page_tail is called, so we can do > > > old_order = thp_order(head) instead of nr = thp_nr_page(head) and use old_order. > > > What am I missing there? > > > > Sure, we could also do that. But what I wrote was true at the time I > > wrote it. > > Sure, I was asking about if you're ok with going back to orders or there are better > ideas. I'm sorry if it wasn't clear and sounded differently. > > It just seems to me than a function is taking nr and order (as in Zi's last version), > I'd expect that it's a number of pages of given order, or something like this. > So I'd avoid mixing them. Orders are slightly better if nr is always a power of two, > it's just more obvious from looking at the code. I think it's awkward no matter which way round we do it. If we pass old_order, new_order then we create extra work for both caller and callee. If we pass old_nr, new_order, it looks weird for humans. At the end of the day, I'm not that invested in which we do.