Re: [PATCH 4/5] mm, hmm: replace hmm_devmem_pages_create() with devm_memremap_pages()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, May 22, 2018 at 10:13 AM, Logan Gunthorpe <logang@xxxxxxxxxxxx> 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.




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux