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=-0.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, 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 32DE5C4320D for ; Tue, 24 Sep 2019 17:07:26 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id E094E2168B for ; Tue, 24 Sep 2019 17:07:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="hcDEnqCq" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E094E2168B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 71DAF6B0006; Tue, 24 Sep 2019 13:07:25 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6A6656B0008; Tue, 24 Sep 2019 13:07:25 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 570606B000A; Tue, 24 Sep 2019 13:07:25 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0187.hostedemail.com [216.40.44.187]) by kanga.kvack.org (Postfix) with ESMTP id 2EBC06B0006 for ; Tue, 24 Sep 2019 13:07:25 -0400 (EDT) Received: from smtpin18.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with SMTP id C84386D86 for ; Tue, 24 Sep 2019 17:07:24 +0000 (UTC) X-FDA: 75970445208.18.turn79_7ad655cae1941 X-HE-Tag: turn79_7ad655cae1941 X-Filterd-Recvd-Size: 6782 Received: from mail-io1-f66.google.com (mail-io1-f66.google.com [209.85.166.66]) by imf50.hostedemail.com (Postfix) with ESMTP for ; Tue, 24 Sep 2019 17:07:23 +0000 (UTC) Received: by mail-io1-f66.google.com with SMTP id r26so6228061ioh.8 for ; Tue, 24 Sep 2019 10:07:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=lmspopvSKpX7B64KcDeaaqo7jPi/4Ao7F6ujlQxBuGE=; b=hcDEnqCq6c4biZl3J7K7tP0DKQ9JAzpWVtMOsVyhDsOwK1Ca7YXRaADqifdZsfBxK7 5fowDdvrvKRMrOhFHJm0S1wSSZaVnkt7nE6t0r8wrldzrkt7jofiucDzmrDp4jtjIdGr VprKVbGpHUYmn0ePw6mO7ytb1umpXoLNto9BB1nw6xLSLimvL7FaiYm6rGYP8VJS3T/e Lqqc360+YVyzPJyJ0HLDEhHCtt+hrfFCOpzZ81xzmIMFbdOp1TqHgB6fgOmeJche3MSq 43ZFEtB4puCyV22ccg7GBY9eLrnPIBLpvee33+WcBox/2wdUM+3Pbds3zhpY/FWgOXlL XtLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=lmspopvSKpX7B64KcDeaaqo7jPi/4Ao7F6ujlQxBuGE=; b=rck5SgM9qGYxhepcC9GO6qwi+yuSvI/pamIPiEsKcGT+6ycQ3b1xHcrw4hvVeJAHgH pJurKES8FagdOGhFUMfB6KHQeNDVnr4OXTTIa6WFicJ8e7SC7csZ1/8n4ohci0ACDQ0P YyOIv+8Wlu/TBuTo0MZhOLwqmRHBkVRqLt4fh9VYyYTyrRbiqx6ciEaAP7JQUqEV+te5 UAkMq6PzOAQewZWJMXwKTgnAFYe9FE581grSQDfJU4H/GZKggGFj75op/+xiVUqtBj6S hCCTzEtR1X0XfzpuaRw5PLDsS1iwQu8DTjORnKhu4eb68A2EZu+Y+mqRm8sXWLh+U2e7 R2Tg== X-Gm-Message-State: APjAAAUXixBaq4trBrv1u838KEVpl+YvRuJGoYfn0FlGYG3RnvSMKK7A Yfc11XPQcZRpXINxXUuUg5vdLbMhV4jxdRi8yzA= X-Google-Smtp-Source: APXvYqzTx4/P0xGyBwbu8UrJ3aYyizZ4e4JPbj3P3E7+rFvspFGEEfawedIVxihESqhtv9T0LO547VkHQL4a0Kac6WE= X-Received: by 2002:a6b:ac85:: with SMTP id v127mr4175604ioe.97.1569344843093; Tue, 24 Sep 2019 10:07:23 -0700 (PDT) MIME-Version: 1.0 References: <20190918175109.23474.67039.stgit@localhost.localdomain> <20190924142342.GX23050@dhcp22.suse.cz> In-Reply-To: From: Alexander Duyck Date: Tue, 24 Sep 2019 10:07:11 -0700 Message-ID: Subject: Re: [PATCH v10 0/6] mm / virtio: Provide support for unused page reporting To: David Hildenbrand Cc: Michal Hocko , virtio-dev@lists.oasis-open.org, kvm list , "Michael S. Tsirkin" , 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 Content-Type: text/plain; charset="UTF-8" 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, Sep 24, 2019 at 8:32 AM David Hildenbrand wrote: > > On 24.09.19 16:23, 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. > > > > 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. > > Adding to what Alexander said, I don't consider the other approaches > (especially the bitmap-based approach Nitesh is currently working on) > infeasible. There might be more rough edges (e.g., sparse zones) and > eventually sometimes a little more work to be done, but definitely > feasible. Incorporating stuff into the buddy might make some tasks > (e.g., identify free pages) more efficient. > > I still somewhat like the idea of capturing hints of free pages (in > whatever data structure) and then going over the hints, seeing if the > pages are still free. Then only temporarily isolating the still-free > pages, reporting them, and un-isolating them after they were reported. I > like the idea that the pages are not fake-allocated but only temporarily > blocked. That works nicely e.g., with the movable zone (contain only > movable data). One other change in this patch set is that I split the headers so that there is an internal header that resides in the mm tree and an external one that provides the page reporting device structure and the register/unregister functions. All that virtio-balloon knows is that it is registering a notifier and will be called with scatter gather lists for memory that is not currently in use by the kernel. It has no visibility into the internal free_areas or the current state of the buddy allocator. Rather than having two blocks that are both trying to maintain that state, I have consolidated it all into the buddy allocator with page reporting. > But anyhow, after decades of people working on free page > hinting/reporting, I am happy with anything that gets accepted upstream :D Agreed. After working on this for 9 months I would be happy to get something upstream that addresses this. - Alex