Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp406736imm; Wed, 18 Jul 2018 04:24:02 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeTUkVesMwv/IWmvLR9gVgijUR+d03dqkhsKWbA/2qeAF/evtgowRupS+O85z6g0z25fJTB X-Received: by 2002:a62:c4c3:: with SMTP id h64-v6mr4770387pfk.39.1531913042056; Wed, 18 Jul 2018 04:24:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531913042; cv=none; d=google.com; s=arc-20160816; b=j3JBc/uAu9fo0WoNGvKv+OeGyAvdibgbqLQsE2hWUvWAW5zyIaNLLsrcTl0OCwWark GODSDgSb29SfroLcKr+T76/o+HFNl3DKT/waUgzbKBhvzQzFnN/8dbz3epjO+gmuzZAv +6Kq8ZAaYm1N256zeaUltmLF0Pa97lmdesdiv5bnQOeMihgc74LjzvfDLZiSlJOPZxiS 4ZFi5fsi7NMLYJC/wLX5RLb8aKz8wuN5zHgfW494V4ScYEGIpt+VpG0c/qN6HdvHxAeX KmwKCK75k8N7IKMtNCPVPVsDx47ztVsxlhaHSfGfJY6PJAQ1uckwymmA/RRYCxoCdduD z0NQ== 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:arc-authentication-results; bh=ZHZpsmOe27mCVKFDfEFUMC1nX4Cec0wkSaOmB5Oi1O0=; b=0ZRTIVCsfihBjgG+v/1zfGRqtBuiGuZdlBfY74eedGOks2Tq106B/cuSHmmlqnFI5f XzX5aI3BOGRTTGBGVc/vTkWT/DLgPUEOWfqZG5/xyL0QTtx7dGXsC0hb8RIrLjr8DOUU IMbGC4s7Qg6PPaVP8d3ZIxTkIaKvxbr8jZa6UHLQW3oAiUsqLKHzWKCkqogDWPBEExh8 ++/5l412UacJ5BdbhVCmGkzR+vNtHaGmwSsoLT+Yij4Fwxgd1yt7HKEpDwbUMV1LD9Pg xNVFHJiKUmtHrHk068uwnbeEFTVcaY8a/S980kLlkOYn34iUSZIM12o+0dpqXJo1xbct zMNg== ARC-Authentication-Results: i=1; mx.google.com; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d14-v6si2929275plr.244.2018.07.18.04.23.46; Wed, 18 Jul 2018 04:24:02 -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; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729972AbeGRMAj (ORCPT + 99 others); Wed, 18 Jul 2018 08:00:39 -0400 Received: from mx2.suse.de ([195.135.220.15]:39690 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726942AbeGRMAj (ORCPT ); Wed, 18 Jul 2018 08:00:39 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 430F2AD9C; Wed, 18 Jul 2018 11:23:07 +0000 (UTC) Date: Wed, 18 Jul 2018 13:23:03 +0200 From: Michal Hocko To: David Hildenbrand Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Alexander Potapenko , Andrew Morton , Andrey Ryabinin , Balbir Singh , Baoquan He , Benjamin Herrenschmidt , Boris Ostrovsky , Dan Williams , Dave Young , Dmitry Vyukov , Greg Kroah-Hartman , Hari Bathini , Huang Ying , Hugh Dickins , Ingo Molnar , Jaewon Kim , Jan Kara , =?iso-8859-1?B?Suly9G1l?= Glisse , Joonsoo Kim , Juergen Gross , Kate Stewart , "Kirill A. Shutemov" , Matthew Wilcox , Mel Gorman , Michael Ellerman , Miles Chen , Oscar Salvador , Paul Mackerras , Pavel Tatashin , Philippe Ombredanne , Rashmica Gupta , Reza Arbab , Souptick Joarder , Tetsuo Handa , Thomas Gleixner , Vlastimil Babka Subject: Re: [PATCH v1 00/10] mm: online/offline 4MB chunks controlled by device driver Message-ID: <20180718112303.GW7193@dhcp22.suse.cz> References: <20180524120341.GF20441@dhcp22.suse.cz> <1a03ac4e-9185-ce8e-a672-c747c3e40ff2@redhat.com> <20180524142241.GJ20441@dhcp22.suse.cz> <819e45c5-6ae3-1dff-3f1d-c0411b6e2e1d@redhat.com> <3748f033-f349-6d88-d189-d77c76565981@redhat.com> <20180611115641.GL13364@dhcp22.suse.cz> <71bd1b65-2a88-5de7-9789-bf4fac26507d@redhat.com> <20180716200517.GA16803@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.0 (2018-05-17) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed 18-07-18 11:56:29, David Hildenbrand wrote: > On 16.07.2018 22:05, Michal Hocko wrote: > > On Mon 16-07-18 21:48:59, David Hildenbrand wrote: > >> On 11.06.2018 14:33, David Hildenbrand wrote: > >>> On 11.06.2018 13:56, Michal Hocko wrote: > >>>> On Mon 11-06-18 13:53:49, David Hildenbrand wrote: > >>>>> On 24.05.2018 23:07, David Hildenbrand wrote: > >>>>>> On 24.05.2018 16:22, Michal Hocko wrote: > >>>>>>> I will go over the rest of the email later I just wanted to make this > >>>>>>> point clear because I suspect we are talking past each other. > >>>>>> > >>>>>> It sounds like we are now talking about how to solve the problem. I like > >>>>>> that :) > >>>>>> > >>>>> > >>>>> Hi Michal, > >>>>> > >>>>> did you have time to think about the details of your proposed idea? > >>>> > >>>> Not really. Sorry about that. It's been busy time. I am planning to > >>>> revisit after merge window closes. > >>>> > >>> > >>> Sure no worries, I still have a bunch of other things to work on. But it > >>> would be nice to clarify soon in which direction I have to head to get > >>> this implemented and upstream (e.g. what I proposed, what you proposed > >>> or maybe something different). > >>> > >> I would really like to make progress here. > >> > >> I pointed out basic problems/questions with the proposed alternative. I > >> think I answered all your questions. But you also said that you are not > >> going to accept the current approach. So some decision has to be made. > >> > >> Although it's very demotivating and frustrating (I hope not all work in > >> the MM area will be like this), if there is no guidance on how to > >> proceed, I'll have to switch to adding/removing/onlining/offlining whole > >> segments. This is not what I want, but maybe this has a higher chance of > >> getting reviews/acks. > >> > >> Understanding that you are busy, please if you make suggestions, follow > >> up on responses. > > > > I plan to get back to this. It's busy time with too many things > > happening both upstream and on my work table as well. Sorry about that. > > I do understand your frustration but there is only that much time I > > have. There are not that many people to review this code unfortunately. > > > > In principle though, I still maintain my position that the memory > > hotplug code is way too subtle to add more on top. Maybe the code can be > > reworked to be less section oriented but that will be a lot of work. > > If you _really_ need a smaller granularity I do not have a better > > suggestion than to emulate that on top of sections. I still have to go > > back to your last emails though. > > > > The only way I see doing the stuff on top will be using a new bit for > marking pages as offline (PageOffline - Patch 1). > > When a section is added, all pages are initialized to PageOffline. > > online_pages() can be then hindered to online specific pages using the > well known hook set_online_page_callback(). Not really. You just make those pages unavailable from the page allocator and mark them reserved. You can keep them linked at your convenience. If you need to put them back to the allocator, just do so and drop the reserved bit. Once you gather a section worth of pages then you can simply offline and remove the whole section. > In my driver, I can manually "soft offline" parts, setting them to > PageOffline or "soft online" them again (including clearing PageOffline). > > offline_pages() can then skip all pages that are already "soft offline" > - PageOffline set - and effectively set the section offline. > > > Without this new bit offline_pages() cannot know if a page is actually > offline or simply reserved by some other part of the system. Imagine > that all parts of a section are "soft offline". Now I want to offline > the section and remove the memory. I would have to temporarily online > all pages again, adding them to the buddy in order to properly offline > them using offline_pages(). Prone to races as these pages must not be > touched. Not really. Once the page is reserved it is yours. You can reuse any parts of the struct page as you wish. You can call the state PageOffline and teach the offlining code to skip them (with some protocol to ensure they will not become online all of the sudden of course). I have no problem to integrate that part into the generic hotplug code. It should be a trivial check at a single place. But I do not think you really need a new page flag for that. -- Michal Hocko SUSE Labs