Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp4933370imm; Tue, 7 Aug 2018 09:41:26 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeuzjqPvSthrW1SaUk68FOI30EJTaxa6sfCC6cSRcTbX9nA7Vc1tMw9Gxqm3VbiAMup3NQL X-Received: by 2002:a17:902:4001:: with SMTP id b1-v6mr18714188pld.208.1533660086479; Tue, 07 Aug 2018 09:41:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533660086; cv=none; d=google.com; s=arc-20160816; b=X2oANqgFgGQzGoAaWrJjdXNZtaFOqlesoz/p6PGSf57xPmXdl9ima5NS4ycrqO0Ag/ UyUnkc9SfnGlXFyGDXYF2CxHikxV08GsrXjUm93toYSkVIV5r3QI9Cp6bJWVrD9XAwx3 YNV3/LbE5qkCfFva8g9aNXhzHPXSJ/Nvlnm2clSiLpOnX2MGeh4o1FprEfbmmxSVIrql xpFAQLGxDCu2DxcyrVYImA6A1goT1VrhXMeS7iVDrFJXmHJz8hlnSaWckbZNYkxMipIn C8YS0xaM9+mC8pimKKVI7cNVXFAPGEFl0doDYmVmqsI4IIR6zx9Fwy0zhtTKY+l0dYN/ SF9w== 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-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date :arc-authentication-results; bh=UtLxsks2EccNlHlTqu9SHqbRcRaIlzj8e+P7VmtQ/14=; b=OcbHWI1zDbISgTVhAp4iTWUod5+sn8R//sWp0od6s8jsiQZZffZix5vQpF0IbO7ASF wGqMVhXfgGvYoCKpRtBjb/hQ3044PCyC2wrOM8wKjsquCG8JqP23QKrETNN076HJheKl 5X4jeCR0njbxYg7gPRtwSEq8eeJEcaVBx61G4CkWF5mXVP4e400S+Mo6+ukkU3kZR8cu jLFi2luR6aEkVMJbaXxU1RDJjRzoxkFfzR4nestMZwXcySg8YI8s3csz6BEmAMJ9Lmnl FWliv+a4MM2hhMCSc0pEWh2sGkPQvblinmeKRif4EOWo56UZq3KDs45nehHposlk8FTw +BFQ== 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 4-v6si1516928pla.311.2018.08.07.09.41.11; Tue, 07 Aug 2018 09:41:26 -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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389903AbeHGReu (ORCPT + 99 others); Tue, 7 Aug 2018 13:34:50 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:50658 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2389271AbeHGRet (ORCPT ); Tue, 7 Aug 2018 13:34:49 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id F2FD240241D5; Tue, 7 Aug 2018 15:19:59 +0000 (UTC) Received: from redhat.com (unknown [10.20.6.215]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 826DD2166BA2; Tue, 7 Aug 2018 15:19:58 +0000 (UTC) Date: Tue, 7 Aug 2018 11:19:57 -0400 From: Jerome Glisse To: David Hildenbrand Cc: osalvador@techadventures.net, 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: <20180807151957.GC3301@redhat.com> References: <20180807133757.18352-1-osalvador@techadventures.net> <20180807133757.18352-3-osalvador@techadventures.net> <20180807135221.GA3301@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.10.0 (2018-05-17) X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Tue, 07 Aug 2018 15:20:00 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Tue, 07 Aug 2018 15:20:00 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'jglisse@redhat.com' RCPT:'' 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 04:54:57PM +0200, David Hildenbrand wrote: > On 07.08.2018 15:52, Jerome Glisse wrote: > > On Tue, Aug 07, 2018 at 03:37:56PM +0200, osalvador@techadventures.net wrote: > >> From: Oscar Salvador > > > > [...] > > > >> diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c > >> index 9bd629944c91..e33555651e46 100644 > >> --- a/mm/memory_hotplug.c > >> +++ b/mm/memory_hotplug.c > > > > [...] > > > >> /** > >> * __remove_pages() - remove sections of pages from a zone > >> - * @zone: zone from which pages need to be removed > >> + * @nid: node which pages belong to > >> * @phys_start_pfn: starting pageframe (must be aligned to start of a section) > >> * @nr_pages: number of pages to remove (must be multiple of section size) > >> * @altmap: alternative device page map or %NULL if default memmap is used > >> @@ -548,7 +557,7 @@ static int __remove_section(struct zone *zone, struct mem_section *ms, > >> * sure that pages are marked reserved and zones are adjust properly by > >> * calling offline_pages(). > >> */ > >> -int __remove_pages(struct zone *zone, unsigned long phys_start_pfn, > >> +int __remove_pages(int nid, unsigned long phys_start_pfn, > >> unsigned long nr_pages, struct vmem_altmap *altmap) > >> { > >> unsigned long i; > >> @@ -556,10 +565,9 @@ int __remove_pages(struct zone *zone, unsigned long phys_start_pfn, > >> int sections_to_remove, ret = 0; > >> > >> /* In the ZONE_DEVICE case device driver owns the memory region */ > >> - if (is_dev_zone(zone)) { > >> - if (altmap) > >> - map_offset = vmem_altmap_offset(altmap); > >> - } else { > >> + if (altmap) > >> + map_offset = vmem_altmap_offset(altmap); > >> + else { > > > > This will break ZONE_DEVICE at least for HMM. While i think that > > altmap -> ZONE_DEVICE (ie altmap imply ZONE_DEVICE) the reverse > > is not true ie ZONE_DEVICE does not necessarily imply altmap. So > > with the above changes you change the expected behavior. You do > > need the zone to know if it is a ZONE_DEVICE. You could also lookup > > one of the struct page but my understanding is that this is what > > you want to avoid in the first place. > > I wonder if we could instead forward from the callers whether we are > dealing with ZONE_DEVICE memory (is_device ...), at least that seems > feasible in hmm code. Not having looked at details yet. > Yes i believe this is doable, this add one more argument, to me it looked like passing down the zone was good idea, i think with the struct zone you can even remove the altmap argument. Is there a reason why you do not want to pass down the struct zone ? Cheers, J?r?me