From mboxrd@z Thu Jan 1 00:00:00 1970 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6C5CBEB64DC for ; Mon, 26 Jun 2023 14:31:54 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EFB138D0006; Mon, 26 Jun 2023 10:31:53 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EAAAF8D0001; Mon, 26 Jun 2023 10:31:53 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D72E08D0006; Mon, 26 Jun 2023 10:31:53 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id C9A268D0001 for ; Mon, 26 Jun 2023 10:31:53 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 484F31607C0 for ; Mon, 26 Jun 2023 14:31:53 +0000 (UTC) X-FDA: 80945138106.21.49EC105 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by imf22.hostedemail.com (Postfix) with ESMTP id F3FE1C007D for ; Mon, 26 Jun 2023 14:31:37 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=quicinc.com header.s=qcppdkim1 header.b=EsJFqPI9; spf=pass (imf22.hostedemail.com: domain of quic_charante@quicinc.com designates 205.220.168.131 as permitted sender) smtp.mailfrom=quic_charante@quicinc.com; dmarc=pass (policy=none) header.from=quicinc.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1687789898; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=EPBgG7RePFl33JUP0Sp09a5Cq4hKOg3JaOTgQmLXP44=; b=V9pezNv1GUvtPY3VCjpMs6kFw4lL61pC+NAl0XD0IGEg+Ye8fQr4BQBzwceAcjI5z0afKl Wqg5LyLZDtRP4KjYy6FBWKmA7a8L/RmGyGyOWUx1HZFCl3p9c+oOfYVukRMJybGr3KQ0Vw BvvpI9y0+lzLzmUrJ+tAINJUJSIdxow= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1687789898; a=rsa-sha256; cv=none; b=d8wjLuRjdsRifgh/tuljkSz/HvsOkOFGO48YHzxPNvZxwBghYncVotX1tCSEL6zBUxWK98 OwYfwgFiFhDwo89Q91HroSuS6tU8EIlTmyQpZ8o0kNiPfkcaPbwMWvEbFtskYocDA8KusG ghNqiep3Wd3GmDnbbG04fmXbaoKyB+w= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=quicinc.com header.s=qcppdkim1 header.b=EsJFqPI9; spf=pass (imf22.hostedemail.com: domain of quic_charante@quicinc.com designates 205.220.168.131 as permitted sender) smtp.mailfrom=quic_charante@quicinc.com; dmarc=pass (policy=none) header.from=quicinc.com 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 35QCVxPv024164; Mon, 26 Jun 2023 14:31:31 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=EPBgG7RePFl33JUP0Sp09a5Cq4hKOg3JaOTgQmLXP44=; b=EsJFqPI9kARvLQYfcvNC+tLFTwQ4Hh4j+wN9CNebuWO8vOhjqAzpNXPxcsX3mur029sC 6/fc83T0PB94NJodGUaMnAmNh6pBmxyDrvLJh+/maARGuGcL0h4oKOVxLzQI4hhGIr53 U4IMoG9zIi4o55/Ccb771dAOeht1ETZftNXhNtO1g56oUOV2AW0of4JN9X+tVXEL0OFT 3sh1kQsi//Vl6Kf3rAUjSfkbWPxfoYwg7zY9SdX+HdRqnP0tID4W8szr5SYiz+CzVt+r fM+HTxW/qq5972srbuNAuayvNw9MrHxplz0RbLI1c7nfv/1NpNrhaiMI52n/vDJUr34N KA== Received: from nalasppmta01.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3rfart88hh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 26 Jun 2023 14:31:30 +0000 Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA01.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 35QEVTFK015488 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 26 Jun 2023 14:31:29 GMT Received: from [10.214.66.119] (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.42; Mon, 26 Jun 2023 07:31:26 -0700 Message-ID: <70743150-dc85-1a1a-87ec-e3dd9f72c5d0@quicinc.com> Date: Mon, 26 Jun 2023 20:01:23 +0530 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.11.2 Subject: Re: [PATCH] mm: madvise: fix uneven accounting of psi Content-Language: en-US To: Suren Baghdasaryan CC: Johannes Weiner , , , , , References: <1685531374-6091-1-git-send-email-quic_charante@quicinc.com> <20230531221955.GD102494@cmpxchg.org> <230e45e8-8cd8-3668-bbfa-a95212b4cb99@quicinc.com> <20230605180013.GD221380@cmpxchg.org> <4543c4e5-43f1-bae2-245e-951437e4bd07@quicinc.com> From: Charan Teja Kalla In-Reply-To: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: rYb3HqzQqoMwNIR0IvxMYEqb-zvBTMxD X-Proofpoint-ORIG-GUID: rYb3HqzQqoMwNIR0IvxMYEqb-zvBTMxD X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-06-26_11,2023-06-26_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=472 clxscore=1015 bulkscore=0 mlxscore=0 lowpriorityscore=0 impostorscore=0 priorityscore=1501 suspectscore=0 malwarescore=0 spamscore=0 adultscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306260130 X-Rspamd-Queue-Id: F3FE1C007D X-Rspam-User: X-Stat-Signature: 5g9bonubod6d6txbrcd6my75s8s14o9i X-Rspamd-Server: rspam03 X-HE-Tag: 1687789897-176576 X-HE-Meta: U2FsdGVkX18PH053bapGJlFCu8uXropW7AZvgATpUcT6WhdvpClNoDKp6hYxJYAwj1B5+hwMy/ksRWb6Zwx1xnjooH0xKpDuGyZFZ8TrELc/hniv/aDcKO4/yzWqfJLntLqbryH9r0vnv/chOGrEcv2HML7m+b8utcxYX3X/bL6r+ELwAb4rQd9YexXIjcI1aT747c03kt+Gg9NmCxTMpIXg6kEIvy+y08tfGYUANIT47RVd1IvTZDH6avCDmb8nTS0YRN0C//jx36UX2SgBoP831f35Bm3/nFljHSS75TFG2K05NVTydWVsysI+ZaQvXDtR9i7HB60PCwj8RtZMqiRL4+EbIP4xVqD2BWhDSsBxjObfdxC18Zv5nNIDvNFgB30NdkWWVlfbSzEiGq5rvaiJmPJ92sXoJqJNVfhjP8MhzlC2Uw/s/hPtd815jfM5S7bFDQYEa3owRnNjjhTFdjvqyqj6/1bvXSzA4OlXkLdi9YmhnmlGBBlquPr2XS8kf4+q914Nj3S5vFFNi3AI+EGeacUzEraqZF0zx9o0Tr0ZL5DdekptsmJNECgcl8PdAs7eMLS5WIp9vTeqh3uxoBOWqXv7FA+MFsd4lq4xfqF91YVJMjczyQOAg3HVZy2BSga4t0sRZS4mWFwBHToVKb1Kt/2x6qqqraMttHL4MC/+nTKuN/1HxceASlcMPUwpVtBOho3bNjEEVdj0KzeXfVznjL3Rh2N+tNnlQRUziQuo/MftUrFzWS9K6r/JjrS5/VfMU5uqD7jljWXqCS7z6IRILJAu3YUrHiTCXg8kMBvscZRPx3nnrcXGEWs+jOGeSHM91p4wGgo3RA4QTD3TRs/P4kVPB6FgJWTK4Bfmpgj9+OcNZAw5nNVaso1FoCrRvtTyLKJMHOaajAEKISR+fpqyCnegd0WjzfonhiJtE3Yl182cKvBBi76YzuUFCVzOeZEsJdhAwWHBSpV9+kC geTJzxZ/ nRe4Vam0CuLAGVihA6lNElXgbZVWlNv8fg0E8lFsmNk9T+2bZTGosvssRX/cx6TCWYgP6fWmyUB5zRVTPAeAw5LWHj7UDuotuqXWu6VXgJWg9D57iulFEvA9DOFMqrdezvPfJCaMJwd8RFuPuJjRT4mxr37F0h0UQPiiAKGHvfFsCciqTI/4g+RufD1c2DAn6a2eWuxBd4L7k8TI= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000001, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Hi Suren, On 6/10/2023 4:43 AM, Suren Baghdasaryan wrote: >>> I can see use for that from userspace to detect incorrect madvise() >>> and adjust its aggressiveness. I think the API might get a bit complex >>> because of the need to associate refaults with specific madvise()/VMAs >>> to understand which hint was incorrect and adjust the behavior. >>> Instead what is the opinion about giving an MADV_PAGEOUT_INACTIVE >> interface which does operate on a page only If it is on the inactive >> list and !PageWorkingset ? > IOW you want a less aggressive mechanism which can be used by the > userspace to tell the kernel "I think these pages won't be used but > I'm not 100% sure, so drop them only if they are inactive"? > I don't know how much that will help when the madvise() ends up being > wrong but maybe you can quickly experiment and tell us if the > difference is substantial? We did some extensive testing on Android and this ask is not helping us much. I am really not sure if there is some other usecase that can benefit from this. So, for now I just stick to your suggestion of making the pages on the Active list as the Workingset at the time of pageout. > Thanks.