[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAPcyv4idV8JbwUQ8tkzFzMV-sfLY15zwE_Xp3F6C_+zajVbxng@mail.gmail.com>
Date: Tue, 22 May 2018 14:38:02 -0700
From: Dan Williams <dan.j.williams@...el.com>
To: Logan Gunthorpe <logang@...tatee.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Christoph Hellwig <hch@....de>,
Jérôme Glisse <jglisse@...hat.com>,
Linux MM <linux-mm@...ck.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 4/5] mm, hmm: replace hmm_devmem_pages_create() with devm_memremap_pages()
On Tue, May 22, 2018 at 10:13 AM, Logan Gunthorpe <logang@...tatee.com> wrote:
>
>
> On 21/05/18 04:35 PM, Dan Williams wrote:
>> + /*
>> + * For device private memory we call add_pages() as we only need to
>> + * allocate and initialize struct page for the device memory. More-
>> + * over the device memory is un-accessible thus we do not want to
>> + * create a linear mapping for the memory like arch_add_memory()
>> + * would do.
>> + *
>> + * For all other device memory types, which are accessible by
>> + * the CPU, we do want the linear mapping and thus use
>> + * arch_add_memory().
>> + */
>> + if (pgmap->type == MEMORY_DEVICE_PRIVATE) {
>> + error = add_pages(nid, align_start >> PAGE_SHIFT,
>> + align_size >> PAGE_SHIFT, NULL, false);
>> + } else {
>> + struct zone *zone;
>> +
>> + error = arch_add_memory(nid, align_start, align_size, altmap,
>> + false);
>> + zone = &NODE_DATA(nid)->node_zones[ZONE_DEVICE];
>> + if (!error)
>> + move_pfn_range_to_zone(zone, align_start >> PAGE_SHIFT,
>> align_size >> PAGE_SHIFT, altmap);
>> + }
>
> Maybe I missed it in the patch but, don't we need the same thing in
> devm_memremap_pages_release() such that it calls the correct remove
> function? Similar to the replaced hmm code:
>
>> - mem_hotplug_begin();
>> - if (resource->desc == IORES_DESC_DEVICE_PRIVATE_MEMORY)
>> - __remove_pages(zone, start_pfn, npages, NULL);
>> - else
>> - arch_remove_memory(start_pfn << PAGE_SHIFT,
>> - npages << PAGE_SHIFT, NULL);
>> - mem_hotplug_done();
>> -
>> - hmm_devmem_radix_release(resource);
>
> Perhaps it should be a separate patch too as it would be easier to see
> outside the big removal of HMM code.
>
Yes, I'll split it out.
Powered by blists - more mailing lists