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=-2.5 required=3.0 tests=MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 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 A4A0EC4360C for ; Thu, 26 Sep 2019 12:22:14 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 70EA0207FF for ; Thu, 26 Sep 2019 12:22:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 70EA0207FF Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 096B16B0008; Thu, 26 Sep 2019 08:22:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 047086B000A; Thu, 26 Sep 2019 08:22:14 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E7F158E0001; Thu, 26 Sep 2019 08:22:13 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id C061D6B0008 for ; Thu, 26 Sep 2019 08:22:13 -0400 (EDT) Received: from smtpin09.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with SMTP id 562B8181AC9CC for ; Thu, 26 Sep 2019 12:22:13 +0000 (UTC) X-FDA: 75976984146.09.bag17_4d8b2ee2f5824 X-HE-Tag: bag17_4d8b2ee2f5824 X-Filterd-Recvd-Size: 5437 Received: from mx1.suse.de (mx2.suse.de [195.135.220.15]) by imf19.hostedemail.com (Postfix) with ESMTP for ; Thu, 26 Sep 2019 12:22:12 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id DA408B11E; Thu, 26 Sep 2019 12:22:10 +0000 (UTC) Date: Thu, 26 Sep 2019 14:22:08 +0200 From: Michal Hocko To: Alexander Duyck Cc: virtio-dev@lists.oasis-open.org, kvm list , "Michael S. Tsirkin" , David Hildenbrand , Dave Hansen , LKML , Matthew Wilcox , linux-mm , Vlastimil Babka , Andrew Morton , Mel Gorman , linux-arm-kernel@lists.infradead.org, Oscar Salvador , Yang Zhang , Pankaj Gupta , Konrad Rzeszutek Wilk , Nitesh Narayan Lal , Rik van Riel , lcapitulino@redhat.com, "Wang, Wei W" , Andrea Arcangeli , Paolo Bonzini , Dan Williams , Alexander Duyck Subject: Re: [PATCH v10 0/6] mm / virtio: Provide support for unused page reporting Message-ID: <20190926122208.GI20255@dhcp22.suse.cz> References: <20190918175109.23474.67039.stgit@localhost.localdomain> <20190924142342.GX23050@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) 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 24-09-19 08:20:22, Alexander Duyck wrote: > On Tue, Sep 24, 2019 at 7:23 AM Michal Hocko wrote: > > > > On Wed 18-09-19 10:52:25, Alexander Duyck wrote: > > [...] > > > In order to try and keep the time needed to find a non-reported page to > > > a minimum we maintain a "reported_boundary" pointer. This pointer is used > > > by the get_unreported_pages iterator to determine at what point it should > > > resume searching for non-reported pages. In order to guarantee pages do > > > not get past the scan I have modified add_to_free_list_tail so that it > > > will not insert pages behind the reported_boundary. > > > > > > If another process needs to perform a massive manipulation of the free > > > list, such as compaction, it can either reset a given individual boundary > > > which will push the boundary back to the list_head, or it can clear the > > > bit indicating the zone is actively processing which will result in the > > > reporting process resetting all of the boundaries for a given zone. > > > > Is this any different from the previous version? The last review > > feedback (both from me and Mel) was that we are not happy to have an > > externally imposed constrains on how the page allocator is supposed to > > maintain its free lists. > > The main change for v10 versus v9 is that I allow the page reporting > boundary to be overridden. Specifically there are two approaches that > can be taken. > > The first is to simply reset the iterator for whatever list is > updated. What this will do is reset the iterator back to list_head and > then you can do whatever you want with that specific list. OK, this is slightly better than pushing the allocator to the corner. The allocator really has to be under control of its data structures. I would still be happier if the allocator wouldn't really have to bother about somebody snooping its internal state to do its own thing. So please make sure to describe why and how much this really matters. > The other option is to simply clear the ZONE_PAGE_REPORTING_ACTIVE > bit. That will essentially notify the page reporting code that any/all > hints that were recorded have been discarded and that it needs to > start over. > > All I am trying to do with this approach is reduce the work. Without > doing this the code has to walk the entire free page list for the > higher orders every iteration and that will not be cheap. How expensive this will be? > Admittedly > it is a bit more invasive than the cut/splice logic used in compaction > which is taking the pages it has already processed and moving them to > the other end of the list. However, I have reduced things so that we > only really are limiting where add_to_free_list_tail can place pages, > and we are having to check/push back the boundaries if a reported page > is removed from a free_list. > > > If this is really the only way to go forward then I would like to hear > > very convincing arguments about other approaches not being feasible. > > There are none in this cover letter unfortunately. This will be really a > > hard sell without them. > > So I had considered several different approaches. Thanks this is certainly useful and it would have been even more so if you gave some rough numbers to quantify how much overhead for different solutions we are talking about here. -- Michal Hocko SUSE Labs