From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (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 C23731DD877 for ; Thu, 16 Jan 2025 11:17:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737026228; cv=none; b=ufd616Q5HHvhW/2CjgKqjkzxNqH//ziW97c4riM0d6LvulZnau4kp1vdzGOExvDRQQKCdQniBV3MGjqXtCzRqLVNxlGCiEUtOag/iobF0Sa9isDrlINkX1CbBeDu/tVO4wH8TaAJmU/yOL6JePhUVg0xXPfXyAP/BxsUtfN3pNA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737026228; c=relaxed/simple; bh=D881yGIJOf7IPo82n0qFSrgoyjZ3GLkqULL5jhJIb6s=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=Qi+YcBYeVgo1cClnMoZZh+LbFdHiN01rDp/wjbPzPG/AfDdNbF+L3wK/w2O6yhGY7ffVrVa64NRqv2hGmnxsWvYymeI5rs7Af0kppOHd4NidRmVfW2wzYYvPsSnrhIMJ7gSCXBbSlbSZlAmrS5cTTwoV70FsmeiQGtmWyP2qqng= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=FdIGXYYZ; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="FdIGXYYZ" Received: from pps.filterd (m0356516.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 50FNbB5x024474; Thu, 16 Jan 2025 11:16:55 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=pp1; bh=CT25o1 ldcD42TecJhYUruCEdXHKdUxqhlTSws99wOqk=; b=FdIGXYYZYFR4vppu3KgnXI S9kDfpqKPmE9rMeNwTYYHMx1nmLMR3BXvZs8Uj2MR8fEWRspuSJIDRzgSOlXZuJ7 uyU/uu327rmbt6YrpGqXq/r1Vj29a9XtWBxAaKo3tpIsxsFug1QmjOSTJ6DFtpQk z+9oc4F9sbXjilZx+ZC3oywfLLGArBmGcVmnVaHSPW7/H8ixGIf3mhdBQaTTQo3E j3zcQK0tr0I710zLII5pzAAJI1TQ2YWdUfXQxvE4GH2C50B41kEAoVvxKdhWrA9y QGgMjpyCSLS8Pe4Cia7GgU8dF4YCg6zdK/ZIcCxWrxRoRWKghTOq0cakJfPANxMg == Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 446pub2nr0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 16 Jan 2025 11:16:54 +0000 (GMT) Received: from m0356516.ppops.net (m0356516.ppops.net [127.0.0.1]) by pps.reinject (8.18.0.8/8.18.0.8) with ESMTP id 50GBGs5p017757; Thu, 16 Jan 2025 11:16:54 GMT Received: from ppma12.dal12v.mail.ibm.com (dc.9e.1632.ip4.static.sl-reverse.com [50.22.158.220]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 446pub2nqx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 16 Jan 2025 11:16:54 +0000 (GMT) Received: from pps.filterd (ppma12.dal12v.mail.ibm.com [127.0.0.1]) by ppma12.dal12v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id 50G905ng004529; Thu, 16 Jan 2025 11:16:53 GMT Received: from smtprelay07.wdc07v.mail.ibm.com ([172.16.1.74]) by ppma12.dal12v.mail.ibm.com (PPS) with ESMTPS id 4442yswq1q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 16 Jan 2025 11:16:53 +0000 Received: from smtpav02.dal12v.mail.ibm.com (smtpav02.dal12v.mail.ibm.com [10.241.53.101]) by smtprelay07.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 50GBGq3O37749074 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 16 Jan 2025 11:16:52 GMT Received: from smtpav02.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 20CC35805C; Thu, 16 Jan 2025 11:16:52 +0000 (GMT) Received: from smtpav02.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 47C4E5805A; Thu, 16 Jan 2025 11:16:48 +0000 (GMT) Received: from [9.171.16.18] (unknown [9.171.16.18]) by smtpav02.dal12v.mail.ibm.com (Postfix) with ESMTP; Thu, 16 Jan 2025 11:16:47 +0000 (GMT) Message-ID: <0b4052bb-5ad3-42a3-a81e-e81d722036b7@linux.ibm.com> Date: Thu, 16 Jan 2025 16:46:46 +0530 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: [RFC] mm/swap.c: Enable promotion of unmapped MGLRU page cache pages To: Gregory Price Cc: Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Yu Zhao , Ritesh Harjani , "Aneesh Kumar K . V" , Matthew Wilcox , David Hildenbrand , Huang Ying , Johannes Weiner References: <20250115120625.3785-1-donettom@linux.ibm.com> Content-Language: en-US From: Donet Tom In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: 51WMpZ8qak11Zd_xh7rh3StnSOtGnKnj X-Proofpoint-ORIG-GUID: lHvSRRx1NjQGfb35k9cq4TSs-qrPM-P5 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-01-16_04,2025-01-16_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 impostorscore=0 spamscore=0 malwarescore=0 lowpriorityscore=0 mlxscore=0 suspectscore=0 priorityscore=1501 bulkscore=0 mlxlogscore=999 clxscore=1015 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2411120000 definitions=main-2501160082 On 1/15/25 21:39, Gregory Price wrote: > On Wed, Jan 15, 2025 at 06:06:25AM -0600, Donet Tom wrote: > ... snip ... > > Thank you for taking the time to do this, I don't have enough background > with MGLRU to have done this quickly. I'll pull this onto my branch and > carry it if you don't mind so we can keep things tracked. > > I'll send you an updated RFC before i send out v4 and add appropriate tags. Sure. Thank you. > >> This difference also impacts read latency: >> >> For MGLRU, the first read shows higher latency due to the combined >> overhead of accessing a lower tier and performing promotion. >> >> For LRU, the first 3–4 reads typically exhibit lower latency since >> promotion does not occur immediately. >> > Do you have a thought on a good test we can use to compare these > strategies? I am also thinking on the same. I will come back with some tests which can compare these strategies. > > We decided against promotion on first-access because there are many > easy-to-imagine scenarios where that will clearly harm performance. Yes, I agree. After the first access, it gets promoted, but if those pages are not accessed afterward, it will become an overhead. I will check if we have any mechanism to restrict it. > > We're planning to do some workload testing soon so we can get actual > benefit numbers. Could you please let me know what workload you are planning? I can try it on my system as well. > >> +promo_candid: >> + if (!folio_test_isolated(folio) && >> + (sysctl_numa_balancing_mode & NUMA_BALANCING_MEMORY_TIERING) && >> + numa_pagecache_promotion_enabled) { > I am considering putting this in some inline wrapper with some likely() > tags to clean this up a bit and optimize the fall-through cases since > i've seen some measurable differences when left as-is. Sounds good to me. > > Thoughts on this are welcome > >> + memcg = folio_memcg(folio); >> + if (memcg) { > Also curious, why only promote when the folio is a member of a memcg? I missed non memcg pages. I will send a V2 with that. ~Donet > > ~Gregory