Re: [PATCH v2 03/10] mm: don't pass "enum lru_list" to lru list addition functions

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

 




在 2021/2/24 下午4:37, Yu Zhao 写道:
>>> @@ -65,18 +63,12 @@ static __always_inline void __clear_page_lru_flags(struct page *page)
>>>   */
>>>  static __always_inline enum lru_list page_lru(struct page *page)
>>>  {
>>> -	enum lru_list lru;
>>> +	unsigned long flags = READ_ONCE(page->flags);
>>>  
>>>  	VM_BUG_ON_PAGE(PageActive(page) && PageUnevictable(page), page);
>>>  
>>> -	if (PageUnevictable(page))
>>> -		return LRU_UNEVICTABLE;
>>> -
>>> -	lru = page_is_file_lru(page) ? LRU_INACTIVE_FILE : LRU_INACTIVE_ANON;
>>> -	if (PageActive(page))
>>> -		lru += LRU_ACTIVE;
>>> -
>>> -	return lru;
>>> +	return (flags & BIT(PG_unevictable)) ? LRU_UNEVICTABLE :
>>> +	       (LRU_FILE * !(flags & BIT(PG_swapbacked)) + !!(flags & BIT(PG_active)));
>> Currently each of page flags used different flags policy, does this mean above flags could be
>> change to PF_ANY policy?
> That's a good question. Semantically, no because
> PG_{active,unevictable} only apply to head pages. But practically,
> I think the answer is yes, and the only place that needs to
> explicitly call compound_head() is gather_stats() in
> fs/proc/task_mmu.c, IIRC.
> 


A quick testing for your testing request:

# ll vmlinux vmlinux.new
-rwxr-xr-x 1 root root 62245304 Feb 24 16:57 vmlinux
-rwxr-xr-x 1 root root 62245280 Feb 24 16:55 vmlinux.new
# gcc --version
gcc (GCC) 8.3.1 20190311 (Red Hat 8.3.1-3)
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

# scripts/bloat-o-meter vmlinux vmlinux.new
add/remove: 0/0 grow/shrink: 1/15 up/down: 1/-2008 (-2007)
Function                                     old     new   delta
vermagic                                      37      38      +1
trace_event_raw_event_mm_lru_insertion       471     418     -53
perf_trace_mm_lru_insertion                  526     473     -53
__munlock_pagevec                           1134    1069     -65
isolate_migratepages_block                  2623    2547     -76
isolate_lru_page                             384     303     -81
__pagevec_lru_add                            753     652    -101
release_pages                                780     667    -113
__page_cache_release                         429     276    -153
move_pages_to_lru                            871     702    -169
lru_lazyfree_fn                              712     539    -173
check_move_unevictable_pages                 938     763    -175
__activate_page                              665     488    -177
lru_deactivate_fn                            636     452    -184
pagevec_move_tail_fn                         597     411    -186
lru_deactivate_file_fn                      1000     751    -249
Total: Before=17029652, After=17027645, chg -0.01%





[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