Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2523598imm; Thu, 16 Aug 2018 10:52:09 -0700 (PDT) X-Google-Smtp-Source: AA+uWPxnUmV6dkurxQmVj9mTY8oB2QAFFbRLPDswnUaw6Umfqfvuk3oYuDfs2e+oNkNwb5ScWVfQ X-Received: by 2002:a17:902:26c:: with SMTP id 99-v6mr29332640plc.341.1534441929624; Thu, 16 Aug 2018 10:52:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534441929; cv=none; d=google.com; s=arc-20160816; b=zABGnSLa+oNlWpiigcYIEtkC0ei/n10FH2GaFBog4t7MZuLfVxKoQtA1+JNVDN5IcQ zfpkO+u0wbtj3/TMmYoFZ4vytlZYuHibkp139eD3rsqZwZWjInewdnLAy5Ki+3egKpx3 nSj8Oo7fc629Ku/+Q1sShRFClyPmFYRR8RU5qQNVaHuzHGEh4uqpQnU6jgzm5C2YIXmS yhrqU4SrSwcPv0YdYN+A3XYZUrqNPxDIuN6SBbtVbMLBB3mr6BiuhpHUCrxcjsyO7u2l ZisniHwXrrXDEmUOvmy5fbRo3BpuqhY3gKJ1UANirt2C7jH5wOic9oMZQYah1J6SHDke AHpQ== 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=OwegCybYnkdi9HYS2tjbDA27vUmWOCD2wUJPhX45qUs=; b=ZTp3UenSwxtcbALX2+0VKMByBYoF4NzJ6uLRB/6myUGgEBBq7AA2uxzcMqmp2gFX2i RI7VQXWZMS9AUkeSZrsjpq0P1tjDA88JEPuMmMdJw5SMfF6PH9cvC5qqnzRgGHqy935k TdJnhMG0MmS7VGLBeqbisa9B3fUD6/bp8e0cA6B1wTqkuWU/Y71yAwt70/D8cj0ZXx6I TqhvUXxUX18akqAW0Q40bQW8AygXbcb4G9tUVM2A+hZLZ+ce/S71RVJupbPiwNSz0IfR JN+qyo3GvIgp1ulvtJBnV1nDsxXPa1igjlK3VVO7AiuecQCETJqirnz6A+pcsJAsIB07 /NmQ== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e1-v6si22019784pld.408.2018.08.16.10.51.54; Thu, 16 Aug 2018 10:52:09 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391048AbeHPNpW (ORCPT + 99 others); Thu, 16 Aug 2018 09:45:22 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:54945 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727640AbeHPNpV (ORCPT ); Thu, 16 Aug 2018 09:45:21 -0400 Received: by mail-wm0-f65.google.com with SMTP id c14-v6so4002219wmb.4 for ; Thu, 16 Aug 2018 03:47:38 -0700 (PDT) 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:references :mime-version:content-disposition:in-reply-to:user-agent; bh=OwegCybYnkdi9HYS2tjbDA27vUmWOCD2wUJPhX45qUs=; b=E2JtJ6m8g/8o65Dd5AldNmPEPm7LtzJqpYLuLRMP8sXgBuCvnlMOo+Fqy4nPhmZ6ct B4TaMrznAGAtGPg4EhVOaEusbcWV7h41ZRZD5I6WDtIcq///8ZNnksfa2Tnbs5EJcQDW eatoHB4BJtuulyZCugWTCMmIENsTG77rf7xl8woBCP3oOza1PpfQ7LynwJtICSXACOpY 3rEch6D9ek+HDi9ZFFyAGUnVxyB7mIwc6pylqm8VWjOibDyuZrAbdVp6lRjvU04Wlv+k FTZ9p4ElxvV8V9McZyScmPw8N3IQvL+d4mAmaQ3VjHSezJ8nGKt57Gf88a2hfRu7I1br 6l2Q== X-Gm-Message-State: AOUpUlFrvTrLu0vWw/VN6VWgvkvppR9Nqn+zZdwVIfcPhcwyGjFyq3Ld GQTwFJFy74HMi0LchV1GJ+8= X-Received: by 2002:a1c:a813:: with SMTP id r19-v6mr15128646wme.100.1534416458300; Thu, 16 Aug 2018 03:47:38 -0700 (PDT) Received: from techadventures.net (techadventures.net. [62.201.165.239]) by smtp.gmail.com with ESMTPSA id r18-v6sm533227wmh.28.2018.08.16.03.47.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 16 Aug 2018 03:47:37 -0700 (PDT) Received: by techadventures.net (Postfix, from userid 1000) id 6C80A1248DC; Thu, 16 Aug 2018 12:47:36 +0200 (CEST) Date: Thu, 16 Aug 2018 12:47:36 +0200 From: Oscar Salvador To: David Hildenbrand Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, Andrew Morton , Michal Hocko , Vlastimil Babka , Stephen Rothwell , Pavel Tatashin , Kemi Wang , David Rientjes , Jia He , Oscar Salvador , Petr Tesarik , Andrey Ryabinin , Dan Williams , Mathieu Malaterre , Baoquan He , Wei Yang , Ross Zwisler , "Kirill A . Shutemov" Subject: Re: [PATCH v1 3/5] mm/memory_hotplug: check if sections are already online/offline Message-ID: <20180816104736.GA16861@techadventures.net> References: <20180816100628.26428-1-david@redhat.com> <20180816100628.26428-4-david@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180816100628.26428-4-david@redhat.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Aug 16, 2018 at 12:06:26PM +0200, David Hildenbrand wrote: > + > +/* check if all mem sections are offline */ > +bool mem_sections_offline(unsigned long pfn, unsigned long end_pfn) > +{ > + for (; pfn < end_pfn; pfn += PAGES_PER_SECTION) { > + unsigned long section_nr = pfn_to_section_nr(pfn); > + > + if (WARN_ON(!valid_section_nr(section_nr))) > + continue; > + if (online_section_nr(section_nr)) > + return false; > + } > + return true; > +} AFAICS pages_correctly_probed will catch this first. pages_correctly_probed checks for the section to be: - present - valid - !online Maybe it makes sense to rename it, and write another pages_correctly_probed routine for the offline case. So all checks would stay in memory_block_action level, and we would not need the mem_sections_offline/online stuff. Thanks -- Oscar Salvador SUSE L3