Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp9968114ybi; Wed, 24 Jul 2019 13:13:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqwJdh1pHMK3NInEp9XmYAMXtaZOPGAqHBpNLYW5fvVv7PbHPtnomP66AMpceIBDgSS5POgL X-Received: by 2002:a63:121b:: with SMTP id h27mr67739461pgl.335.1563999224240; Wed, 24 Jul 2019 13:13:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563999224; cv=none; d=google.com; s=arc-20160816; b=ELpbS/d2kO+5j2Ve6tIMXFnnIHdtA1/ED4y5zxaL0bRNS5db2NHwVoQapS794Zbq88 SBUNfMaTjksuFPWBL759JxtFFzC4fjig+2O2EWy2etR57LWQZpxcEmGX90yv+8BvAcJ4 rwsfHtgvhi9ummPhDPkLeqkX0R9cElNNIZPt/c7w1/UfBwytM5oqScUcCuNWL9j/pdk1 J3UHVCsZvAdaX30d6wgVOgZH4OiNUp3kEqp3RLlSQv0xOOEpa8Wd4Lr+7d1RoIWAuXlz n6w0lE67zMsPzjNt/01pDWkaaifn16tPEcb2XvktEK93ucEkvUwQX4eVvX4bewMJ9gf8 gwRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=+PNL04KYvInZXteiwuvvVomp7psYL1Kl+T8ycx6EmRk=; b=TIss5UFhpElL4S8VfdC52ZMz8oRHt6vK9NCiFqDwIcJAedH+I4h5kStYIvuS5q0Ull Tn1p1WRav0pdFe4Oz2PMGUqqZPlU7aaMow+SAXfbOcmIrhaQ4DIyvMrX+H1xggFEuutE oCoOWz/i3cfTZcpFd3LlEH8QbMFbU04BiLIYeT7xM6ETGTVRBTv616QKoEZGsNdss8EE v5/+Zx87VY3kNgxyUiw1TQWr0hxJpqg14+HFOQq+lhbVY3kGAz5iruAPNHhrKq06TZEU c5WVSXSCm/9ElejpR1npUtdCuVDaYaQ83EUqrDNNYlznoAB9NrG+dXgoeTYIZ1/6vy6u CtOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b="nMkbt/qr"; 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=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v141si19411468pgb.183.2019.07.24.13.13.29; Wed, 24 Jul 2019 13:13:44 -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; dkim=pass header.i=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b="nMkbt/qr"; 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392828AbfGXUMG (ORCPT + 99 others); Wed, 24 Jul 2019 16:12:06 -0400 Received: from mail-ot1-f66.google.com ([209.85.210.66]:42628 "EHLO mail-ot1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388645AbfGXUMF (ORCPT ); Wed, 24 Jul 2019 16:12:05 -0400 Received: by mail-ot1-f66.google.com with SMTP id l15so49179861otn.9 for ; Wed, 24 Jul 2019 13:12:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=+PNL04KYvInZXteiwuvvVomp7psYL1Kl+T8ycx6EmRk=; b=nMkbt/qriVy9O40AoW5FYNfDVr8RyGGaYJ40joGq40jdmhquOlREtNDZ/xeGpk9EHD gXIrt4W1XVVNC6/Rd2cAvNqLFpGVzBldC5FrJdtpyV4dVO8ZxSE8mfwUvBpjKm1jzl17 krrSZj+MzqvjS3VrNAzKy8wM81/5FUxqLeDnL3zJG6EW31/OdglL16Ms8Uggn9Qz2FUQ y4aYlFANRwJZE2ZsU9dZEqXS7iUWtbd/J+qYJcO23brfsDmTeNV2Rw9ByujWw5xbW40z 0ldixykjhsbNKz/35tArF46weN+pr4TRfpajnHEBiwS7hXFUaIYfGGIyG3ZPouMGNZhX vamQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=+PNL04KYvInZXteiwuvvVomp7psYL1Kl+T8ycx6EmRk=; b=sECSvh1FwyZuee+JIm7ja9MpsECaRjvjcLoMqHb249N4R9PInje++CxaRrzJ6chDTv kx5NE50zng1WRVCtzHJ+jKgWlJaQU+PiYzaT4NvmyL/YFIGcjbOmDHrBY6VZ4Tl4imT5 yyw4b/tAy9+wC8dtsjLaTi4/inD3Av/YKkrnolCZgY7Mejrd8+t5dm+a+sxOc3sEsd7q SEb7yL5isAsR6dKaKLkp9eS6sWTKsjuQzbvfq2b8l7ZEqiOb2E8uj8t95XFkgb40rxse 65EQOdGfkZxHFqtffMkKMdoQDTxGJK4pgKpa7GINdXdUubq1kG5ZscdsFZQAVSiJT15c Z5wg== X-Gm-Message-State: APjAAAXuNJ2UPWuLRd+j6+/T+0V9/vCj0TAi/R3OXq6nmHMglpv1wchE kBhD2/ueFc5vnkd1gcVjxFtR5jy108c74NkDEzKbcQ== X-Received: by 2002:a9d:7b48:: with SMTP id f8mr36294684oto.207.1563999124513; Wed, 24 Jul 2019 13:12:04 -0700 (PDT) MIME-Version: 1.0 References: <20190625075227.15193-1-osalvador@suse.de> <20190625075227.15193-3-osalvador@suse.de> In-Reply-To: <20190625075227.15193-3-osalvador@suse.de> From: Dan Williams Date: Wed, 24 Jul 2019 13:11:52 -0700 Message-ID: Subject: Re: [PATCH v2 2/5] mm,memory_hotplug: Introduce MHP_VMEMMAP_FLAGS To: Oscar Salvador Cc: Andrew Morton , Michal Hocko , Pavel Tatashin , Jonathan Cameron , David Hildenbrand , Anshuman Khandual , Vlastimil Babka , Linux MM , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 25, 2019 at 12:53 AM Oscar Salvador wrote: > > This patch introduces MHP_MEMMAP_DEVICE and MHP_MEMMAP_MEMBLOCK flags, > and prepares the callers that add memory to take a "flags" parameter. > This "flags" parameter will be evaluated later on in Patch#3 > to init mhp_restrictions struct. > > The callers are: > > add_memory > __add_memory > add_memory_resource > > Unfortunately, we do not have a single entry point to add memory, as depending > on the requisites of the caller, they want to hook up in different places, > (e.g: Xen reserve_additional_memory()), so we have to spread the parameter > in the three callers. > > The flags are either MHP_MEMMAP_DEVICE or MHP_MEMMAP_MEMBLOCK, and only differ > in the way they allocate vmemmap pages within the memory blocks. > > MHP_MEMMAP_MEMBLOCK: > - With this flag, we will allocate vmemmap pages in each memory block. > This means that if we hot-add a range that spans multiple memory blocks, > we will use the beginning of each memory block for the vmemmap pages. > This strategy is good for cases where the caller wants the flexiblity > to hot-remove memory in a different granularity than when it was added. > > E.g: > We allocate a range (x,y], that spans 3 memory blocks, and given > memory block size = 128MB. > [memblock#0 ] > [0 - 511 pfns ] - vmemmaps for section#0 > [512 - 32767 pfns ] - normal memory > > [memblock#1 ] > [32768 - 33279 pfns] - vmemmaps for section#1 > [33280 - 65535 pfns] - normal memory > > [memblock#2 ] > [65536 - 66047 pfns] - vmemmap for section#2 > [66048 - 98304 pfns] - normal memory > > MHP_MEMMAP_DEVICE: > - With this flag, we will store all vmemmap pages at the beginning of > hot-added memory. > > E.g: > We allocate a range (x,y], that spans 3 memory blocks, and given > memory block size = 128MB. > [memblock #0 ] > [0 - 1533 pfns ] - vmemmap for section#{0-2} > [1534 - 98304 pfns] - normal memory > > When using larger memory blocks (1GB or 2GB), the principle is the same. > > Of course, MHP_MEMMAP_DEVICE is nicer when it comes to have a large contigous > area, while MHP_MEMMAP_MEMBLOCK allows us to have flexibility when removing the > memory. Concept and patch looks good to me, but I don't quite like the proliferation of the _DEVICE naming, in theory it need not necessarily be ZONE_DEVICE that is the only user of that flag. I also think it might be useful to assign a flag for the default 'allocate from RAM' case, just so the code is explicit. So, how about: MHP_MEMMAP_PAGE_ALLOC MHP_MEMMAP_MEMBLOCK MHP_MEMMAP_RESERVED ...for the 3 cases? Other than that, feel free to add: Reviewed-by: Dan Williams