lkml.org 
[lkml]   [2018]   [Oct]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 08/17] prmem: struct page: track vmap_area
From
Date


On 24/10/2018 06:12, Matthew Wilcox wrote:
> On Wed, Oct 24, 2018 at 12:34:55AM +0300, Igor Stoppa wrote:
>> The connection between each page and its vmap_area avoids more expensive
>> searches through the btree of vmap_areas.
>
> Typo -- it's an rbtree.

ack

>> +++ b/include/linux/mm_types.h
>> @@ -87,13 +87,24 @@ struct page {
>> /* See page-flags.h for PAGE_MAPPING_FLAGS */
>> struct address_space *mapping;
>> pgoff_t index; /* Our offset within mapping. */
>> - /**
>> - * @private: Mapping-private opaque data.
>> - * Usually used for buffer_heads if PagePrivate.
>> - * Used for swp_entry_t if PageSwapCache.
>> - * Indicates order in the buddy system if PageBuddy.
>> - */
>> - unsigned long private;
>> + union {
>> + /**
>> + * @private: Mapping-private opaque data.
>> + * Usually used for buffer_heads if
>> + * PagePrivate.
>> + * Used for swp_entry_t if PageSwapCache.
>> + * Indicates order in the buddy system if
>> + * PageBuddy.
>> + */
>> + unsigned long private;
>> + /**
>> + * @area: reference to the containing area
>> + * For pages that are mapped into a virtually
>> + * contiguous area, avoids performing a more
>> + * expensive lookup.
>> + */
>> + struct vmap_area *area;
>> + };
>
> Not like this. Make it part of a different struct in the existing union,
> not a part of the pagecache struct. And there's no need to use ->private
> explicitly.

Ok, I'll have a look at the googledoc you made

>> @@ -1747,6 +1750,10 @@ void *__vmalloc_node_range(unsigned long size, unsigned long align,
>> if (!addr)
>> return NULL;
>>
>> + va = __find_vmap_area((unsigned long)addr);
>> + for (i = 0; i < va->vm->nr_pages; i++)
>> + va->vm->pages[i]->area = va;
>
> I don't like it that you're calling this for _every_ vmalloc() caller
> when most of them will never use this. Perhaps have page->va be initially
> NULL and then cache the lookup in it when it's accessed for the first time.
>

If __find_vmap_area() was part of the API, this loop could be left out
from __vmalloc_node_range() and the user of the allocation could
initialize the field, if needed.

What is the reason for keeping __find_vmap_area() private?

--
igor

\
 
 \ /
  Last update: 2018-10-25 01:02    [W:0.055 / U:1.480 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site