Re: [-mm PATCH v2 11/25] x86, mm: introduce vmem_altmap to augment vmemmap_populate()

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

 



On Tue, Dec 15, 2015 at 3:28 PM, Andrew Morton
<akpm@xxxxxxxxxxxxxxxxxxxx> wrote:
> On Wed, 09 Dec 2015 18:38:12 -0800 Dan Williams <dan.j.williams@xxxxxxxxx> wrote:
>
>> In support of providing struct page for large persistent memory
>> capacities, use struct vmem_altmap to change the default policy for
>> allocating memory for the memmap array.  The default vmemmap_populate()
>> allocates page table storage area from the page allocator.  Given
>> persistent memory capacities relative to DRAM it may not be feasible to
>> store the memmap in 'System Memory'.  Instead vmem_altmap represents
>> pre-allocated "device pages" to satisfy vmemmap_alloc_block_buf()
>> requests.
>>
>> ...
>>
>>  include/linux/mm.h              |   92 +++++++++++++++++++++++++++++++++++++--
>
> mm.h is getting ridiculously huge and these additions look to be fairly
> standalone.  Perhaps you could take a look at creating a vmem_altmap.h
> sometime if feeling bored?
>

Will do, and the pfn_t inlines can also move out.

>> +
>> +/**
>> + * vmem_altmap_alloc - allocate pages from the vmem_altmap reservation
>> + * @altmap - reserved page pool for the allocation
>> + * @nr_pfns - size (in pages) of the allocation
>> + *
>> + * Allocations are aligned to the size of the request
>> + */
>> +static inline unsigned long vmem_altmap_alloc(struct vmem_altmap *altmap,
>> +             unsigned long nr_pfns)
>> +{
>> +     unsigned long pfn = vmem_altmap_next_pfn(altmap);
>> +     unsigned long nr_align;
>> +
>> +     nr_align = 1UL << find_first_bit(&nr_pfns, BITS_PER_LONG);
>> +     nr_align = ALIGN(pfn, nr_align) - pfn;
>> +
>> +     if (nr_pfns + nr_align > vmem_altmap_nr_free(altmap))
>> +             return ULONG_MAX;
>> +     altmap->alloc += nr_pfns;
>> +     altmap->align += nr_align;
>> +     return pfn + nr_align;
>> +}
>
> This look pretty large for an inline.  But it has only one callsite so
> it doesn't matter.  But if it only has one callsite, why is it in .h?

I'll move it.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>



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