diff mbox series

[v3,3/6] mm/vmscan: activate swap-backed executable folios after first usage

Message ID 20220425111232.23182-4-linmiaohe@huawei.com (mailing list archive)
State New
Headers show
Series A few cleanup and fixup patches for vmscan | expand

Commit Message

Miaohe Lin April 25, 2022, 11:12 a.m. UTC
We should activate swap-backed executable folios (e.g. tmpfs) after first
usage so that executable code gets yet better chance to stay in memory.

Suggested-by: Huang, Ying <ying.huang@intel.com>
Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
Reviewed-by: Huang, Ying <ying.huang@intel.com>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
---
 mm/vmscan.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Andrew Morton April 25, 2022, 9:07 p.m. UTC | #1
On Mon, 25 Apr 2022 19:12:29 +0800 Miaohe Lin <linmiaohe@huawei.com> wrote:

> We should activate swap-backed executable folios (e.g. tmpfs) after first
> usage so that executable code gets yet better chance to stay in memory.

Does this not erase the intended effect of Joonsoo's b518154e59a
("mm/vmscan: protect the workingset on anonymous LRU")?
Huang, Ying April 26, 2022, 2:02 a.m. UTC | #2
On Mon, 2022-04-25 at 14:07 -0700, Andrew Morton wrote:
> On Mon, 25 Apr 2022 19:12:29 +0800 Miaohe Lin <linmiaohe@huawei.com> wrote:
> 
> > We should activate swap-backed executable folios (e.g. tmpfs) after first
> > usage so that executable code gets yet better chance to stay in memory.
> 
> Does this not erase the intended effect of Joonsoo's b518154e59a
> ("mm/vmscan: protect the workingset on anonymous LRU")?

I don't think so.  This is only for executable folios (vm_flags &
VM_EXEC).  The behavior for all other anonymous pages are not affected.

Best Regards,
Huang, Ying
Miaohe Lin April 26, 2022, 6:58 a.m. UTC | #3
On 2022/4/26 10:02, ying.huang@intel.com wrote:
> On Mon, 2022-04-25 at 14:07 -0700, Andrew Morton wrote:
>> On Mon, 25 Apr 2022 19:12:29 +0800 Miaohe Lin <linmiaohe@huawei.com> wrote:
>>
>>> We should activate swap-backed executable folios (e.g. tmpfs) after first
>>> usage so that executable code gets yet better chance to stay in memory.
>>
>> Does this not erase the intended effect of Joonsoo's b518154e59a
>> ("mm/vmscan: protect the workingset on anonymous LRU")?
> 
> I don't think so.  This is only for executable folios (vm_flags &
> VM_EXEC).  The behavior for all other anonymous pages are not affected.
> 

Agree. Only executable folios are changed! Thanks both!

> Best Regards,
> Huang, Ying
> 
> .
>
Joonsoo Kim April 27, 2022, 4:08 a.m. UTC | #4
Hello,

2022년 4월 26일 (화) 오후 3:58, Miaohe Lin <linmiaohe@huawei.com>님이 작성:
>
> On 2022/4/26 10:02, ying.huang@intel.com wrote:
> > On Mon, 2022-04-25 at 14:07 -0700, Andrew Morton wrote:
> >> On Mon, 25 Apr 2022 19:12:29 +0800 Miaohe Lin <linmiaohe@huawei.com> wrote:
> >>
> >>> We should activate swap-backed executable folios (e.g. tmpfs) after first
> >>> usage so that executable code gets yet better chance to stay in memory.

Missing activation for swap-backed executable page is the intended operation.
So, I disagree with this patch until some numbers are provided.
See following discussion.

https://lore.kernel.org/all/20200316161208.GB67986@cmpxchg.org/T/#u

Thanks.
Huang, Ying April 27, 2022, 6:10 a.m. UTC | #5
On Wed, 2022-04-27 at 13:08 +0900, Joonsoo Kim wrote:
> Hello,
> 
> 2022년 4월 26일 (화) 오후 3:58, Miaohe Lin <linmiaohe@huawei.com>님이 작성:
> > 
> > On 2022/4/26 10:02, ying.huang@intel.com wrote:
> > > On Mon, 2022-04-25 at 14:07 -0700, Andrew Morton wrote:
> > > > On Mon, 25 Apr 2022 19:12:29 +0800 Miaohe Lin <linmiaohe@huawei.com> wrote:
> > > > 
> > > > > We should activate swap-backed executable folios (e.g. tmpfs) after first
> > > > > usage so that executable code gets yet better chance to stay in memory.
> 
> Missing activation for swap-backed executable page is the intended operation.
> So, I disagree with this patch until some numbers are provided.
> See following discussion.
> 
> https://lore.kernel.org/all/20200316161208.GB67986@cmpxchg.org/T/#u

Thanks for your pointer.  Now I understood more about this.  I agree to
keep the original behavior unless we can prove the change with numbers.

Best Regards,
Huang, Ying
Miaohe Lin April 27, 2022, 6:36 a.m. UTC | #6
On 2022/4/27 14:10, ying.huang@intel.com wrote:
> On Wed, 2022-04-27 at 13:08 +0900, Joonsoo Kim wrote:
>> Hello,
>>
>> 2022년 4월 26일 (화) 오후 3:58, Miaohe Lin <linmiaohe@huawei.com>님이 작성:
>>>
>>> On 2022/4/26 10:02, ying.huang@intel.com wrote:
>>>> On Mon, 2022-04-25 at 14:07 -0700, Andrew Morton wrote:
>>>>> On Mon, 25 Apr 2022 19:12:29 +0800 Miaohe Lin <linmiaohe@huawei.com> wrote:
>>>>>
>>>>>> We should activate swap-backed executable folios (e.g. tmpfs) after first
>>>>>> usage so that executable code gets yet better chance to stay in memory.
>>
>> Missing activation for swap-backed executable page is the intended operation.
>> So, I disagree with this patch until some numbers are provided.
>> See following discussion.
>>
>> https://lore.kernel.org/all/20200316161208.GB67986@cmpxchg.org/T/#u
> 
> Thanks for your pointer.  Now I understood more about this.  I agree to
> keep the original behavior unless we can prove the change with numbers.
> 

Many thanks both! I will keep the original behavior. :)

> Best Regards,
> Huang, Ying
> 
> 
> .
>
diff mbox series

Patch

diff --git a/mm/vmscan.c b/mm/vmscan.c
index 7dcc8cf4526f..82e6fa83c472 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -1415,9 +1415,9 @@  static enum page_references folio_check_references(struct folio *folio,
 			return PAGEREF_ACTIVATE;
 
 		/*
-		 * Activate file-backed executable folios after first usage.
+		 * Activate executable folios after first usage.
 		 */
-		if ((vm_flags & VM_EXEC) && !folio_test_swapbacked(folio))
+		if (vm_flags & VM_EXEC)
 			return PAGEREF_ACTIVATE;
 
 		return PAGEREF_KEEP;