Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DCE75C636D4 for ; Sat, 11 Feb 2023 00:45:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229710AbjBKApj (ORCPT ); Fri, 10 Feb 2023 19:45:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33646 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229640AbjBKAph (ORCPT ); Fri, 10 Feb 2023 19:45:37 -0500 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3BCEA6FE9D; Fri, 10 Feb 2023 16:45:22 -0800 (PST) Received: from pps.filterd (m0279862.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 31B0DWoF011753; Sat, 11 Feb 2023 00:45:00 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=message-id : date : mime-version : subject : to : cc : references : from : in-reply-to : content-type : content-transfer-encoding; s=qcppdkim1; bh=Yi2o++dUEfoYlvI54l/P7unrYv7/0a8aA9pCNXs6y8o=; b=Uzyy6/yqVbr5cwp2hg3XJ5IIA7C1qi+zDh9y6qsWGaCaGWfpEVDNb3O8P/DRAE+brTiP SSSVe9IqKlg6hD3CO3yMc7wdhXP7w8fyhBaYVyrmf5yTWndmUOmOLVnmfLHtRPshz5cR QpXCt3wh0tuCk0PXpJNaoXGbPxIk/Nc58u/Vjkfu+FrQ8S6QOO/uFONYwOkS2hD6qYQc osMTbn6OOJuxw7NhBQVp3YT1kv7Gt+/DGGjkVVmvfj4Bso4xNn1ccrJSX/mX+wEPK/Mc kMdhbucp4u393eLdsQRuuefqkq8X9zqu+U6i1gcJTjdOGlQ+Q90mAclrFNY7NKu2JldH xA== Received: from nasanppmta05.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3nnrxdryju-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 11 Feb 2023 00:44:59 +0000 Received: from nasanex01b.na.qualcomm.com (nasanex01b.na.qualcomm.com [10.46.141.250]) by NASANPPMTA05.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 31B0ixNF010460 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 11 Feb 2023 00:44:59 GMT Received: from [10.110.94.147] (10.80.80.8) by nasanex01b.na.qualcomm.com (10.46.141.250) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36; Fri, 10 Feb 2023 16:44:58 -0800 Message-ID: Date: Fri, 10 Feb 2023 16:44:57 -0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.1.1 Subject: Re: [PATCH] psi: reduce min window size to 50ms Content-Language: en-US To: Suren Baghdasaryan CC: David Hildenbrand , Johannes Weiner , Mike Rapoport , Oscar Salvador , Anshuman Khandual , , , , , , , , Trilok Soni , Sukadev Bhattiprolu , Srivatsa Vaddagiri , Patrick Daly , "Sudarshan Rajagopalan" References: From: Sudarshan Rajagopalan In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nasanex01b.na.qualcomm.com (10.46.141.250) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: Mc3GQN-Aive3V1QhXHRmilSvDVgOop0s X-Proofpoint-ORIG-GUID: Mc3GQN-Aive3V1QhXHRmilSvDVgOop0s X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.170.22 definitions=2023-02-10_17,2023-02-09_03,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 adultscore=0 suspectscore=0 mlxscore=0 lowpriorityscore=0 spamscore=0 phishscore=0 bulkscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2302110003 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2/10/2023 3:03 PM, Suren Baghdasaryan wrote: > On Fri, Feb 10, 2023 at 2:31 PM Sudarshan Rajagopalan > wrote: >> The PSI mechanism is useful tool to monitor pressure stall >> information in the system. Currently, the minimum window size >> is set to 500ms. May we know what is the rationale for this? > The limit was set to avoid regressions in performance and power > consumption if the window is set too small and the system ends up > polling too frequently. That said, the limit was chosen based on > results of specific experiments which might not represent all Rightly as you said, the effect on power and performance depends on type of the system - embedded systems, or Android mobile, or commercial VMs or servers. With higher PSI sampling, it may not be much of power impact to embedded systems with low-tier chipsets or performance impact to powerful servers. > usecases. If you want to change this limit, you would need to describe > why the new limit is inherently better than the current one (why not > higher, why not lower). This is in regards to the userspace daemon [1] that we are working on, that dynamically resizes the VM memory based on PSI memory pressure events. With current min window size of 500ms, the PSI monitor sampling period would be 50ms. So to detect increase in memory demand in system and plug-in memory into VM when pressure goes up, the minimum time the process needs to stall for is 50ms before a event can be generated and sent out to userspace and the daemon can do actions. This again I'm talking w.r.t. lightweight embedded systems, where even background kswapd/kcompd (which I'm calling it as natural memory pressure) in the system would be less than 5-10ms stall. So any stall more than 5-10ms would "hint" us that a memory consuming usecase has ranB and memory may need to be plugged in. So in these cases, having as low as 5ms psimon sampling time would give us faster reaction time and daemon can be responsive more quickly. In general, this will reduce the malloc latencies significantly. Pasting here the same excerpt I mentioned in [1]. " 4. Detecting increase in memory demand b