Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp519167imm; Wed, 8 Aug 2018 00:39:50 -0700 (PDT) X-Google-Smtp-Source: AA+uWPwOsUIaUqWxCdoMHQbH6T54RrwKykZlNeWWgvp14YJTGmER+p7BPLuMok25onhbIGwO6/Ft X-Received: by 2002:a65:4849:: with SMTP id i9-v6mr1456022pgs.350.1533713990466; Wed, 08 Aug 2018 00:39:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533713990; cv=none; d=google.com; s=arc-20160816; b=J1aSo8EfCFdUA21ZeJt8FBO/3DbnnlYYZqz8UNGGr2lvu5jo05+QDsFbsDHfVWvOJa iNZsLTtKko1+DwhchLS8JWi+X3JJ2moOIB1xMxD1Oui83NQVm3tcovStvA8EU5zeF24L tUKQYH+F+6VOjgRc4p3glKUNGyqZbyIV1/rBbJIqj1VE9JszTDWjDcrvD6OSbT96wJF7 Dtx0BajcmQxUXdrspJErWRBGNW3tFESLF+SNb7vTs8tY8+PsAUCsR3X5ShJYnBkbnrb6 /ado/5AeEAzzBaPfiC8FolEcIgFyGelwWX4sC3Jlh69VwGGqq/U+LF8Tuk+TFv/ggFDl 9CZg== 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=QSUkCzv0KmOT0y96k9iexRlheO+mhe9fWp3mCh/VAO8=; b=WCnVRyTKiQHcFZszrxl3maFzVfr297B25PYi2gqkBC/768pAtqoRASUL5QarPOyDkJ Wa9BG6XquqJbsLTwzrtZoK4ZKD2Qdgd6JBenR2sBgwccVtWqiWC6RXBfEH3TNCS6IAjH y5ZEYIvfmzU5SvaQjsaJdQtbI6rQE48CHrY2ZyBTUH9B4O+SGaLg4uoAMfvBzVKuaqSd fcAp5B3cMU9DiHF6AYoY0sqaP13xuiFmRSeKzGJbNwAHTyrwW0hoH3rtBjrPpkdDBdaM 0QXaNHWwSTNN4vUTooyTgqGRNZ9bC5rsjK1aRKx+3DRUz58lTrCr0jzZafNLmQIPlL5W eu8g== 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 z125-v6si4026504pfz.10.2018.08.08.00.39.35; Wed, 08 Aug 2018 00:39:50 -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 S1726999AbeHHJ5D (ORCPT + 99 others); Wed, 8 Aug 2018 05:57:03 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:37117 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726869AbeHHJ5D (ORCPT ); Wed, 8 Aug 2018 05:57:03 -0400 Received: by mail-wr1-f65.google.com with SMTP id u12-v6so1094608wrr.4 for ; Wed, 08 Aug 2018 00:38:37 -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=QSUkCzv0KmOT0y96k9iexRlheO+mhe9fWp3mCh/VAO8=; b=nsQvDmLKVg5qbDgPz4h2bYJuYDOBaZI7r5jQeMlIOvD1epKj7hejvlvvj1Fp8wu8oS cSRGnZai7BhfB/0pujER59Im5i8WabJw1pyWc2sgdoMQronP0ypc3tsevX4F5HNake+g KWPNe+d6n7gLrgnI4CXOaj7brBAe/OP/vmbucTeQxQD+1XEVkuuN7rGZNeUd/GJWEZ3x mzgYqphwRT4ZH7Z0IQKrA6DhqITSxzh+pjJJHjYk9tNtOYXykIhen5So3noglj89JCFG Ulvbis5KGpF8cayJgWQT5GSbyEyUOe61MJBNqvJWKaJ7dvU6E//2SU7lUob9KBhQZNGq fsqg== X-Gm-Message-State: AOUpUlFOk1ybBaVN2S05Pw5ah2yhMveqSHSoKrtZ82dLhOXmeerslJJw hD1WfHWZklTWaizkw0iX1Rg= X-Received: by 2002:adf:84e5:: with SMTP id 92-v6mr1134511wrg.56.1533713916810; Wed, 08 Aug 2018 00:38:36 -0700 (PDT) Received: from techadventures.net (techadventures.net. [62.201.165.239]) by smtp.gmail.com with ESMTPSA id v65-v6sm4478465wme.22.2018.08.08.00.38.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 08 Aug 2018 00:38:36 -0700 (PDT) Received: by techadventures.net (Postfix, from userid 1000) id 42F25124766; Wed, 8 Aug 2018 09:38:35 +0200 (CEST) Date: Wed, 8 Aug 2018 09:38:35 +0200 From: Oscar Salvador To: Jerome Glisse Cc: David Hildenbrand , akpm@linux-foundation.org, mhocko@suse.com, dan.j.williams@intel.com, pasha.tatashin@oracle.com, yasu.isimatu@gmail.com, logang@deltatee.com, dave.jiang@intel.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Oscar Salvador Subject: Re: [RFC PATCH 2/3] mm/memory_hotplug: Create __shrink_pages and move it to offline_pages Message-ID: <20180808073835.GA9568@techadventures.net> References: <20180807133757.18352-1-osalvador@techadventures.net> <20180807133757.18352-3-osalvador@techadventures.net> <20180807135221.GA3301@redhat.com> <20180807204834.GA6844@techadventures.net> <20180807221345.GD3301@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180807221345.GD3301@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 Tue, Aug 07, 2018 at 06:13:45PM -0400, Jerome Glisse wrote: > > And since we know for sure that memhotplug-code cannot call it with ZONE_DEVICE, > > I think this can be done easily. > > This might change down road but for now this is correct. They are > talks to enumerate device memory through standard platform mechanisms > and thus the kernel might see new types of resources down the road and > maybe we will want to hotplug them directly from regular hotplug path > as ZONE_DEVICE (lot of hypothetical at this point ;)). Well, I think that if that happens this whole thing will become much easier, since we will not have several paths for doing the same thing. Another thing that I realized is that while we want to move all operation-pages from remove_memory() path to offline_pages(), this can get tricky. Unless I am missing something, the devices from HMM and devm are not being registered against "memory_subsys" struct, and so, they never get to call memory_subsys_offline() and so offline_pages(). Which means that we would have to call __remove_zone() from those paths. But this alone will not work. find_smallest/biggest_section_pfn are two functions that are being called from shrink_pgdat_span and shrink_zone_span to adjust zone_first_pfn/node_first_pfn and the spanned pages. Currently, find_smallest/biggest_section_pfn checks for the secion to be valid, and this is fine since we are removing those sections from the remove_memory path. But if we want to move __remove_zone() to offline_pages(), we have to use online_section() instead of valid_section(). This is all fine from offline_pages because the sections get offlined in: __offline_pages offline_isolated_pages offline_isolated_pages_cb __offline_isolated_pages offline_mem_sections But this does not happen in HMM/devm path. I am pretty sure this is a dumb question, but why HMM/devm path do not call online_pages/offline_pages? Thanks -- Oscar Salvador SUSE L3