Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp244951pxk; Thu, 17 Sep 2020 01:40:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyYXnb0fjJVKyyMNcI4kt6LZTeILWU6GM4op4xkrKflUzCXvyGouboMqcSopBmUZVaTX9OT X-Received: by 2002:a17:906:3a0e:: with SMTP id z14mr28822976eje.192.1600332002130; Thu, 17 Sep 2020 01:40:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600332002; cv=none; d=google.com; s=arc-20160816; b=kzpLyklJn0OI/tcKwlwayrXABu1MMXEp5FcXXQb8Q+uaavdRuaBFlAZr4LLRcbx5uE p7wRIZ6T9jWBECv7nXAcGoqnsS/lalrW/r/hieOWRVKDVJmYQF2O4xTWtEwkgFSmtN9a gtZZJ2m88uFwPZa+q6+voNlHR6A8gAJUcN9DtHKtP0JlWirTpzzwDmxCC+GBulp2wcwk J419ffKATsh3yFshfTSAYjqiPFDU+mwNnT7GD4bBXR+2NPzI0r8DFCUdJ085hhoOPzhD 6hlUYvyyCbVQsA/u84zxOiA0oqbuexot/8BbOOt4H6aVJFBK0T1vNpN0l8yP9GAa0b5I IabQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=3SD5Nhn2XpQ1H9kVLH/qfgLHEz7YapANneIn1r8dtW0=; b=xtHk+MNHDXne1OvXZCwNxU345JwflPI2dScBA5U2LGj5V+MROi+bfbrPVALP+/bkPb e1wJQhCj5iVFN1KqxxpaQh0JYnm6y1l4yuARw4GWxN+0EuidhqXCvGdzY8I7c5A9v3Oh zbdYNh66sjdYxBnH3S5+kXYVYZ+0i3sAmi42Ry5g3o9WK1hRXa0rFNYPhQbfaDmi36+/ DY4EigknKfECTqxtO0l/noWwFYrCaKhnJwgJUco2iub70tp3Kd0aerrnwCouofb1ynhR MRH5wD1ptjSghAgV04FbzzngNfz/9fLd25KTRqGktp5f7qRduq8Rl2jdZrZ3JeE0se1f 0Juw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=TZSJDBlK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id l8si14218659edr.396.2020.09.17.01.39.38; Thu, 17 Sep 2020 01:40:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=TZSJDBlK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1726378AbgIQIid (ORCPT + 99 others); Thu, 17 Sep 2020 04:38:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60806 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726171AbgIQIiW (ORCPT ); Thu, 17 Sep 2020 04:38:22 -0400 Received: from mail-io1-xd43.google.com (mail-io1-xd43.google.com [IPv6:2607:f8b0:4864:20::d43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 92C6CC06174A; Thu, 17 Sep 2020 01:38:21 -0700 (PDT) Received: by mail-io1-xd43.google.com with SMTP id m17so1320777ioo.1; Thu, 17 Sep 2020 01:38:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=3SD5Nhn2XpQ1H9kVLH/qfgLHEz7YapANneIn1r8dtW0=; b=TZSJDBlKn2juCBNKdJKkGxFA6d9tkU2NYk6fbYz/5pjucep8Xm9pIXb2u4iXyNLGO/ DuT9nL8k91Crr4kc/dF5KOOUQcMDcGQEkVQ6VfWjCXY9jijvwqxvOSubethpMY4/We8b yoZpQLubk6ivZDbWKkce6ntZFL9xITFXNacYNtWvVN0PSX0M7m9OCbT7Lg1hV4IngvLZ VY/2EKBI9VDQA1bPAEQtnve/J0t9Yo7qGAus6Eifth/VGsT3TUG/KuTIqYx0/cLFilpX /ZTW7pZdgJE/kItf9BISJ/b2Giig7KKHdK5hxZ1qxbHRwOWejvpubQtrOfAdi+G8c3F4 eTcQ== 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=3SD5Nhn2XpQ1H9kVLH/qfgLHEz7YapANneIn1r8dtW0=; b=ZgHH/K/ctfrvtwtcysuDkmbyoMr/EKeg9Wsz4ZRb3ZQyzDn/dkrkCurnNv1N3FKakf 7cj2JjzvL5Jns1zL82iQbaCIfnZSjC5YoPpngyyUho2ATzMfBwgk6Qav5UYJukUdTpmN ku0AyjoVN0/y3NHm8B3Z3LjT6KKwD77J5P05zMH4TDYyv7UFZT4n5lqYQrgC3AHf7J/W LXv15VZY6slkggLknzWFo6qDqjirvaPV06J96ZxzCmOBYw9tTkjn+VREW/vptNjpLZ9h QPdUhXR6Jh8TjEvfqa5CDJUvhktHaiPHL4hRVCRJxaglVm8pQ72KPjvWw54bmA1uvZkk Dqqg== X-Gm-Message-State: AOAM533tqSZLAsyS+yZqpHVAE9N5UhabFFsEO6bU0oVnWLgmBEG8xxFI CuA3bDRP9yS1XY7DMLqTUO5dPZEVFK2KUloLjYc= X-Received: by 2002:a5e:8707:: with SMTP id y7mr23060083ioj.49.1600331900788; Thu, 17 Sep 2020 01:38:20 -0700 (PDT) MIME-Version: 1.0 References: <20200911103459.10306-1-david@redhat.com> <20200916073041.10355-1-david@redhat.com> In-Reply-To: <20200916073041.10355-1-david@redhat.com> From: Pankaj Gupta Date: Thu, 17 Sep 2020 10:38:09 +0200 Message-ID: Subject: Re: [PATCH] kernel/resource: make iomem_resource implicit in release_mem_region_adjustable() To: David Hildenbrand Cc: LKML , virtualization@lists.linux-foundation.org, Linux MM , linux-hyperv@vger.kernel.org, xen-devel@lists.xenproject.org, linux-acpi@vger.kernel.org, linux-nvdimm , linux-s390@vger.kernel.org, Andrew Morton , Wei Yang , Michal Hocko , Dan Williams , Jason Gunthorpe , Kees Cook , Ard Biesheuvel , Baoquan He Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > "mem" in the name already indicates the root, similar to > release_mem_region() and devm_request_mem_region(). Make it implicit. > The only single caller always passes iomem_resource, other parents are > not applicable. > > Suggested-by: Wei Yang > Cc: Andrew Morton > Cc: Michal Hocko > Cc: Dan Williams > Cc: Jason Gunthorpe > Cc: Kees Cook > Cc: Ard Biesheuvel > Cc: Pankaj Gupta > Cc: Baoquan He > Cc: Wei Yang > Signed-off-by: David Hildenbrand > --- > > Based on next-20200915. Follow up on > "[PATCH v4 0/8] selective merging of system ram resources" [1] > That's in next-20200915. As noted during review of v2 by Wei [2]. > > [1] https://lkml.kernel.org/r/20200911103459.10306-1-david@redhat.com > [2] https://lkml.kernel.org/r/20200915021012.GC2007@L-31X9LVDL-1304.local > > --- > include/linux/ioport.h | 3 +-- > kernel/resource.c | 5 ++--- > mm/memory_hotplug.c | 2 +- > 3 files changed, 4 insertions(+), 6 deletions(-) > > diff --git a/include/linux/ioport.h b/include/linux/ioport.h > index 7e61389dcb01..5135d4b86cd6 100644 > --- a/include/linux/ioport.h > +++ b/include/linux/ioport.h > @@ -251,8 +251,7 @@ extern struct resource * __request_region(struct resource *, > extern void __release_region(struct resource *, resource_size_t, > resource_size_t); > #ifdef CONFIG_MEMORY_HOTREMOVE > -extern void release_mem_region_adjustable(struct resource *, resource_size_t, > - resource_size_t); > +extern void release_mem_region_adjustable(resource_size_t, resource_size_t); > #endif > #ifdef CONFIG_MEMORY_HOTPLUG > extern void merge_system_ram_resource(struct resource *res); > diff --git a/kernel/resource.c b/kernel/resource.c > index 7a91b935f4c2..ca2a666e4317 100644 > --- a/kernel/resource.c > +++ b/kernel/resource.c > @@ -1240,7 +1240,6 @@ EXPORT_SYMBOL(__release_region); > #ifdef CONFIG_MEMORY_HOTREMOVE > /** > * release_mem_region_adjustable - release a previously reserved memory region > - * @parent: parent resource descriptor > * @start: resource start address > * @size: resource region size > * > @@ -1258,9 +1257,9 @@ EXPORT_SYMBOL(__release_region); > * assumes that all children remain in the lower address entry for > * simplicity. Enhance this logic when necessary. > */ > -void release_mem_region_adjustable(struct resource *parent, > - resource_size_t start, resource_size_t size) > +void release_mem_region_adjustable(resource_size_t start, resource_size_t size) > { > + struct resource *parent = &iomem_resource; > struct resource *new_res = NULL; > bool alloc_nofail = false; > struct resource **p; > diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c > index 553c718226b3..7c5e4744ac51 100644 > --- a/mm/memory_hotplug.c > +++ b/mm/memory_hotplug.c > @@ -1764,7 +1764,7 @@ static int __ref try_remove_memory(int nid, u64 start, u64 size) > memblock_remove(start, size); > } > > - release_mem_region_adjustable(&iomem_resource, start, size); > + release_mem_region_adjustable(start, size); > > try_offline_node(nid); > Reviewed-by: Pankaj Gupta