Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp639042imu; Fri, 16 Nov 2018 07:59:34 -0800 (PST) X-Google-Smtp-Source: AJdET5cqiGnwca9xm6sdBp7YLGdI6eWwPdR4WLTVbL1xuobCuQR1OKrVkKGGhYuWiDkHqqSAlr9z X-Received: by 2002:a63:6704:: with SMTP id b4mr10478108pgc.100.1542383974200; Fri, 16 Nov 2018 07:59:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542383974; cv=none; d=google.com; s=arc-20160816; b=HiJOL0PPmxDuTVLpx4rMMoJLbH3XCiLktDiiCWJU8iA1oLBRY03cV0R4q/qHydhmEd 6jJ2qGKHj1CDCqjQWXkSf7khl7bTg3g8tLsFUOf9eokpSQ394croQDpCDC+00HO+N6s8 dCv9vyr8UTAGD1VaUEUf2M+ae99LQftoyY8GGW3YQkk/WffU0OC1+4ivniYhxk6uFy1O 2JisKYtEWUSiprspTULHnpyrrN115okQyvxg+X1sL2XMeAWfph/AHS+EqvY0oVLITxc9 CWQ93JEcDHW/sFLG/dq4RLBzseSs7ItkG7MO7b0Cp58lIaAe2M5cso8zBfMz6jpK8jG+ Qh+Q== 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:reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=9QfZ/Yw+4fN5/J9kjVur5sXg3qsFZ+oxUY0Pe4KXb5c=; b=KgQFjuXwTFQDuwtIlsch+3/O2cz+VKOIp7K5OWtiXmZOo5hcIsJ3RDrNH19t6oav7f i2ys1hb6CV5KP0kMpN88qRWdAliapNlRrAwYrbWnxgLCTYWqXvNr3y3vIjdQAjf/u/mN SfUrWWpLGjrAry7O6KKfBlkMTV30mmN5YvVg+dh3oE8bHlmXQe9WKVfN9O8ZDbMfDKhO Ycz2kkfDJL95AqOoFsJZZI3T5/tUpE5inOCKvQE74apjzs2pfOaDwr8E6QrBANPWTAnh GkztTcBsnvBguGTdJmegYNbd4wAqVXj3o5yfhMA/37gHfvo3pDEOdjTK3buMs0LWL2IU /Zuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=OpMXnv+f; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s198-v6si39119016pfs.248.2018.11.16.07.59.19; Fri, 16 Nov 2018 07:59:34 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=OpMXnv+f; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729055AbeKQCL0 (ORCPT + 99 others); Fri, 16 Nov 2018 21:11:26 -0500 Received: from mail-ed1-f65.google.com ([209.85.208.65]:37380 "EHLO mail-ed1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728124AbeKQCLZ (ORCPT ); Fri, 16 Nov 2018 21:11:25 -0500 Received: by mail-ed1-f65.google.com with SMTP id h15so15277215edb.4 for ; Fri, 16 Nov 2018 07:58:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:reply-to:references:mime-version :content-disposition:in-reply-to:user-agent; bh=9QfZ/Yw+4fN5/J9kjVur5sXg3qsFZ+oxUY0Pe4KXb5c=; b=OpMXnv+f91+CL2lCDjDXvamspzWkG4nwleucSuR0PvpFP3dCsWHR5vJgyjxDlwRQ00 0HzbbuunwVc4YCVP0uYosygZ8yNqwrK6OZIZ+4NR/o/9f5bPIWrqWW08U0MM9RTm+N6x TlBZKB0RoVr53gFNiBC3d38AVnoI/ir6XcAaDOGZT3kknxXI9Gp7HTuIi3emOB0czVk0 pUV6D2yNPI0w18cwlXkQnR77IEtybmjwkEUf0gbhJnoU9EVkDEIK0SQRK1l3j1Lu595B eRw0uBkShNK6XSIKxZ/YP2uaL8ZU0wZnDxKVObMj/g/QNUMSh11GEI1J8sPSuFXT5ID6 AAuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:reply-to :references:mime-version:content-disposition:in-reply-to:user-agent; bh=9QfZ/Yw+4fN5/J9kjVur5sXg3qsFZ+oxUY0Pe4KXb5c=; b=OFAGuXqYd9sRft38ifNVSYOJ9VdQF4etcFYIrKnTSSklBd/xvMVs9036XqNpGSmDfU VQBXRh5RO9zXdttxYxlqlFJd73++taUnEehIn/0lPHYs6JmxcaLThudlYcYg/VPDFVx1 JJSc0UdZzG0RbDGePF0o5/KhnXRA/SqkmUMclL+e68kf16+W9u4r5EDhVGTx1FfwmniZ ilc/faT7wtvrJqhmkgEeLj+JBnLDz5ju/2KKbdQUUKwNxpq5k6pGN/Ce7qXq0dTNI05Z 5Q8Yn+VyAGygSz9XGwkr2pu2hm9ZGlLVIBgVgFrCRb40CIM2Rr2HPYcRf3qQ+v3bcv3Y 2I+Q== X-Gm-Message-State: AGRZ1gK/9SYs7LQYZHoOufZL/7woTW0Z9ilKAvcE7oYi4sOR+TiM/MHQ Hvvm01zGhEZuAQrTJkpKZy6q8L1Q X-Received: by 2002:a17:906:bb02:: with SMTP id jz2-v6mr8862879ejb.59.1542383909279; Fri, 16 Nov 2018 07:58:29 -0800 (PST) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id x47sm2399100eda.91.2018.11.16.07.58.28 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 16 Nov 2018 07:58:28 -0800 (PST) Date: Fri, 16 Nov 2018 15:58:28 +0000 From: Wei Yang To: Michal Hocko Cc: osalvador , Andrew Morton , Wei Yang , 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: <20181116155828.strdglxqgqe4jqkr@master> Reply-To: Wei Yang 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181116112603.GI14706@dhcp22.suse.cz> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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? >-- >Michal Hocko >SUSE Labs -- Wei Yang Help you, Help me