Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp2796849pxk; Tue, 15 Sep 2020 02:35:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyO4C0+veJwV+5NnDEDHfwglmnG7hxWXziDbIXQ/n2AApQq6YlhhHm78RahyuxVZ05elEnn X-Received: by 2002:aa7:ca4f:: with SMTP id j15mr17631695edt.233.1600162505303; Tue, 15 Sep 2020 02:35:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600162505; cv=none; d=google.com; s=arc-20160816; b=TFF2fW6YFrexbcMUMjNu/YpPKXopjpVCPaYABeCW+elIO4sYmVQorr7eGlEpptha0u KQhI/TY844cbymROtPDyh4VdoERbcRXGXy9mrrzW0iC5UZlLMsNXGG+XtogqkQlYAAKN hnHt3xwaCXK+YmaTnaslw+RTuOzcTZ3tbsBMpIFMGIoVjDghlgK3nYyg6W3550lyby9q F1ekrAT7s0avwed/L4IKxbhaWe/NMK27MTlDMc2NweSI0JOZjOwClFVuVX+if0/LsrPR KMw9gQnTHyRRC5ZsEKvwSEOwPl8EXSElHIj9ObwYo6akHAbkb1pU5xctUY6FTeYWDpmG SBNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:reply-to:message-id:subject:cc:to:from:date; bh=qW92IBtZS8VdA9Cf0mik+69lJ3sS64My48Pk2q+0/ME=; b=Eofz+q1tHdFACiguFCAo3/NVqVn7tWBg08/XV0RGDT5Twxpg1DwRUAJtCaqvN0I+qH rsuV4XlarJ3MHxKWrez+SGZA1ZU6EE7a6Zf7XxIoO9bhVDQQ9MEndxv7cH7TxJZAebwj o99va+n77VlBFycU6XUCUF2SrvJfgONPrbXu/p5K/ny9pBbMVO39mzLsGuiGKn845iou wHauFoNA9LQgqrVEQyKuXvEMEnhUT83DAX81xBAplI1vZA2IugF/KUUIH1COH0rnGUB1 gFBEhnf7sP5BrH2NdUKESyIYBEttWu+YdYe/JL5jxW7I6Bdl6345JKlNKuohAfrgwZw8 LVuw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r1si8524169eja.274.2020.09.15.02.34.43; Tue, 15 Sep 2020 02:35:05 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726471AbgIOJdy (ORCPT + 99 others); Tue, 15 Sep 2020 05:33:54 -0400 Received: from out30-45.freemail.mail.aliyun.com ([115.124.30.45]:40910 "EHLO out30-45.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726208AbgIOJdt (ORCPT ); Tue, 15 Sep 2020 05:33:49 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R811e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04394;MF=richard.weiyang@linux.alibaba.com;NM=1;PH=DS;RN=18;SR=0;TI=SMTPD_---0U90t1fN_1600162424; Received: from localhost(mailfrom:richard.weiyang@linux.alibaba.com fp:SMTPD_---0U90t1fN_1600162424) by smtp.aliyun-inc.com(127.0.0.1); Tue, 15 Sep 2020 17:33:45 +0800 Date: Tue, 15 Sep 2020 17:33:44 +0800 From: Wei Yang To: David Hildenbrand Cc: Wei Yang , linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, linux-mm@kvack.org, linux-hyperv@vger.kernel.org, xen-devel@lists.xenproject.org, linux-acpi@vger.kernel.org, linux-nvdimm@lists.01.org, linux-s390@vger.kernel.org, Andrew Morton , Michal Hocko , Dan Williams , Jason Gunthorpe , Kees Cook , Ard Biesheuvel , Pankaj Gupta , Baoquan He Subject: Re: [PATCH v2 1/7] kernel/resource: make release_mem_region_adjustable() never fail Message-ID: <20200915093344.GA7324@L-31X9LVDL-1304.local> Reply-To: Wei Yang References: <20200908201012.44168-1-david@redhat.com> <20200908201012.44168-2-david@redhat.com> <20200915021012.GC2007@L-31X9LVDL-1304.local> <927904b1-1909-f11f-483e-8012bda8ad0c@redhat.com> <20200915090612.GA6936@L-31X9LVDL-1304.local> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 15, 2020 at 11:15:53AM +0200, David Hildenbrand wrote: >On 15.09.20 11:06, Wei Yang wrote: >> On Tue, Sep 15, 2020 at 09:35:30AM +0200, David Hildenbrand wrote: >>> >>>>> static int __ref try_remove_memory(int nid, u64 start, u64 size) >>>>> { >>>>> int rc = 0; >>>>> @@ -1777,7 +1757,7 @@ static int __ref try_remove_memory(int nid, u64 start, u64 size) >>>>> memblock_remove(start, size); >>>>> } >>>>> >>>>> - __release_memory_resource(start, size); >>>>> + release_mem_region_adjustable(&iomem_resource, start, size); >>>>> >>>> >>>> Seems the only user of release_mem_region_adjustable() is here, can we move >>>> iomem_resource into the function body? Actually, we don't iterate the resource >>>> tree from any level. We always start from the root. >>> >>> You mean, making iomem_resource implicit? I can spot that something >>> similar was done for >>> >>> #define devm_release_mem_region(dev, start, n) \ >>> __devm_release_region(dev, &iomem_resource, (start), (n)) >>> >> >> What I prefer is remove iomem_resource from the parameter list. Just use is in >> the function body. >> >> For the example you listed, __release_region() would have varies of *parent*, >> which looks reasonable to keep it here. > >Yeah I got that ("making iomem_resource implicit"), as I said: > Thanks >>> I'll send an addon patch for that, ok? - thanks. > >-- >Thanks, > >David / dhildenb -- Wei Yang Help you, Help me