From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out30-133.freemail.mail.aliyun.com (out30-133.freemail.mail.aliyun.com [115.124.30.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7CE8437E5CB for ; Wed, 15 Jul 2026 09:00:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.133 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784106030; cv=none; b=mnBgLtOOa0lWkIyKYS7Rogzd4y/bWwDQ5iudk68+NQVJB8AmLY9aIsfTE1A3k0zfHLmQk9I5j2YKhre2WuujgBkFj+vaT++aD/bl0ZY/hXXsgmDvFiw/uRThUIbrE5zb8hFelgRtwJcj5senMtMmcBprHwAvW3hoYb9P1VJaFJc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784106030; c=relaxed/simple; bh=T5jJfooCqs6FDw2enkXQerLC5+TEWIdVxX6BgruhOBo=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=TEVu0M+ezZ5JiUjfR/8mf1PKkbAdL+ivTLh4uuXy6lQQ340r/6SpTnahLEpKS2NFWE1AILVKNDXcbpCfNwqPvix2zoHK4xJDJOtamY69VVX9s8EPbsVoUbEbJc8WiYakS3HS4h6MMEHd5Wa4dpSXa3w7IInohtjubXTSTbZazK8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com; spf=pass smtp.mailfrom=linux.alibaba.com; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b=RLTK8yuC; arc=none smtp.client-ip=115.124.30.133 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b="RLTK8yuC" DKIM-Signature:v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1784106021; h=Message-ID:Date:MIME-Version:Subject:To:From:Content-Type; bh=nXvZ2rVRfCU7hF4KotTtBujPHyPsXz49glGFVAjhZuY=; b=RLTK8yuCainXkMUPhd54hXYcE3DZfsIRD/kb3sF1exczzZAw5naYReYZ95qp/cXamMLqYgQjs07KU+o9JhjvnMZLJhZn+d31dCA2ppk0KIl+E6JcMjTyAf9Fxrp7QAealu0o+dvPuQ01Wnkx1oLxCobC1FjsVI4D0usY2SNePbs= X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R151e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=maildocker-contentspam033045098064;MF=baolin.wang@linux.alibaba.com;NM=1;PH=DS;RN=13;SR=0;TI=SMTPD_---0X78c3co_1784106019; Received: from 30.74.144.123(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0X78c3co_1784106019 cluster:ay36) by smtp.aliyun-inc.com; Wed, 15 Jul 2026 17:00:20 +0800 Message-ID: <0fdd8922-3087-4636-aa5d-27074462fa6d@linux.alibaba.com> Date: Wed, 15 Jul 2026 17:00:19 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] mm: mglru: promote mapped executable folios after first usage To: Barry Song Cc: akpm@linux-foundation.org, kasong@tencent.com, qi.zheng@linux.dev, shakeel.butt@linux.dev, axelrasmussen@google.com, yuanchu@google.com, weixugc@google.com, david@kernel.org, mhocko@kernel.org, ljs@kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <4b921ed528c483e13c9e22d1ae44ba58b4a15b0b.1784096432.git.baolin.wang@linux.alibaba.com> From: Baolin Wang In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 7/15/26 3:57 PM, Barry Song wrote: > On Wed, Jul 15, 2026 at 3:54 PM Barry Song wrote: > [...] >>>> >>>> Hi Baolin, >>>> >>>> Because ARM doesn't set the surrounding PTEs to young, while x86 >>>> may behave differently and mark the surrounding PTEs as young as >>>> well. Could we also collect the data on x86? >>>> >>>> void set_pte_range(struct vm_fault *vmf, struct folio *folio, >>>> struct page *page, unsigned int nr, unsigned long addr) >>>> { >>>> ... >>>> >>>> if (prefault && arch_wants_old_prefaulted_pte()) >>>> entry = pte_mkold(entry); >>>> else >>>> entry = pte_sw_mkyoung(entry); >>> >>> Sure. But I don't think it's very relevant to this point. MGLRU doesn't >>> protect normally accessed mmaped exec file folios well enough. Anyway, >>> I'll test it on x86. >> >> My point is that even mmaped executable folios that have never been >> accessed might still get promoted because they already have the accessed >> bit set. :-) > > Second thought: we don't do much readahead for VM_EXEC since it is > considered random access. So maybe I am being over-cautious here. > The data will tell us :-) Yes. Besides, even if an exec folio gets promoted incorrectly at first, it can still be reclaimed as it ages without further accesses. This is the same logic as the classical LRU. I did a quick test with the same test case on my x86 machine, and I still see an improvement in sys time. base patched 1152.249s 993.235s