Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp718984imu; Fri, 16 Nov 2018 09:08:59 -0800 (PST) X-Google-Smtp-Source: AJdET5dgTeGEY0w4f5mMOFDIyXTzVNHUktACuzA90mcfTctKtT/XRvtveRI3JUSteZezazt7V2ei X-Received: by 2002:a63:4f5e:: with SMTP id p30mr10667614pgl.71.1542388139761; Fri, 16 Nov 2018 09:08:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542388139; cv=none; d=google.com; s=arc-20160816; b=ugntps38fqHPjDbBGNnYI0bYJTNKowQ8mbAEP3oSACTuz6pY2gOxE+MjmBEnK11Jmz /6Iqh6C290C7prPXI6CKaMrdQ8l9ZHno2I48NvGjaP/0gpmw6mL3cIB1tGv1MVDmsOup 66Fjth/kPmi4jkSgUo7diSLLtXedNXk+S3fGIaCQBnmf3AxdjrDTOuHeSN12Zmj6CGQX eGx6GU7yIMbI4+vltBYsDA7g2bJZqwG9mA1HFFClsLiuh+GidpQ1c3WxJVapE/tOzqPt 3ijmcc7xawFuIXvaR5RPz0MnfkYKk+/M1VJMSOD/qwJitVj/h7CE25RCFxQditRE78ez ubOw== 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; bh=XxskTyM4o+1EXrJd/Zq6jR6WSLrLgYS+PD6mRD23v0M=; b=nW1BlJeggvQQe1N/FSgNZwIpN8iPl9cvH9N+Cr7p3fSuso71+dCRsZsOKG9J/P94qH qdMY1AbIu9x7AdCYDrIqiLQxNOgF8gYTGwCrXcH22jJoU3lOPD/ZlJOGKR13CLgZQ60J P/Pl6i9g5U+I6+ryo923JLbnpCKukx750sKTb3QKxn6AX0iEX5VIg0xT97timRShdXKN /WL3BrXv0NaWm/4RQG2XrdyIYte5G14G9LueHKy7e/Bq/a6vWrVZ6thM2f+9LzmrNf9U V0qHf7iQPKQawibglw/GUNXkLw/tnFo6db5p/wiQp/3A5CClNPN5/XFs085G/dUse2U+ JR2Q== 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 e1si11556031pln.55.2018.11.16.09.08.44; Fri, 16 Nov 2018 09:08:59 -0800 (PST) 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 S2390087AbeKQDVJ (ORCPT + 99 others); Fri, 16 Nov 2018 22:21:09 -0500 Received: from mx2.suse.de ([195.135.220.15]:45084 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728628AbeKQDVJ (ORCPT ); Fri, 16 Nov 2018 22:21:09 -0500 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 1AFF5B063; Fri, 16 Nov 2018 17:07:56 +0000 (UTC) Date: Fri, 16 Nov 2018 18:07:55 +0100 From: Michal Hocko To: Wei Yang Cc: osalvador , Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm: use managed_zone() for more exact check in zone iteration Message-ID: <20181116170755.GN14706@dhcp22.suse.cz> References: <20181114235040.36180-1-richard.weiyang@gmail.com> <20181115133735.bb0313ec9293c415d08be550@linux-foundation.org> <20181116095720.GE14706@dhcp22.suse.cz> <1542366304.3020.15.camel@suse.de> <20181116112603.GI14706@dhcp22.suse.cz> <20181116155828.strdglxqgqe4jqkr@master> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181116155828.strdglxqgqe4jqkr@master> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri 16-11-18 15:58:28, Wei Yang wrote: > On Fri, Nov 16, 2018 at 12:26:03PM +0100, Michal Hocko wrote: > >On Fri 16-11-18 12:05:04, osalvador wrote: > >> On Fri, 2018-11-16 at 10:57 +0100, Michal Hocko wrote: > >[...] > >> > E.g. memory hotplug decreases both managed and present counters. I > >> > am actually not sure that is 100% correct (put on my TODO list to > >> > check). There is no consistency in that regards. > >> > >> We can only offline non-reserved pages (so, managed pages). > > > >Yes > > > >> Since present pages holds reserved_pages + managed_pages, decreasing > >> both should be fine unless I am mistaken. > > > >Well, present_pages is defined as "physical pages existing within the zone" > >and those pages are still existing but they are offline. But as I've > >said I have to think about it some more > > I may not catch up with your discussions, while I'd like to share what I > learnt. > > online_pages() > online_pages_range() > zone->present_pages += onlined_pages; > > __offline_pages() > adjust_managed_page_count() > zone->present_pages -= offlined_pages; > > The two counters: present_pages & managed_pages would be adjusted during > online/offline. > > While I am not sure when *reserved_pages* would be adjusted. Will we add > this hot-added memory into memblock.reserved? and allocate memory by > memblock_alloc() after system bootup? This is not really related to this patch. I have only mentioned the memory hotplug as an example. I would rather focus on the change itself so let's not get too off topic here. -- Michal Hocko SUSE Labs