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 38E26C43217 for ; Thu, 1 Dec 2022 13:36:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9FEA66B0072; Thu, 1 Dec 2022 08:36:54 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 9AEC66B0073; Thu, 1 Dec 2022 08:36:54 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 84FBF6B0074; Thu, 1 Dec 2022 08:36:54 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 72AB56B0072 for ; Thu, 1 Dec 2022 08:36:54 -0500 (EST) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id A3EE91C6593 for ; Thu, 1 Dec 2022 13:36:53 +0000 (UTC) X-FDA: 80193837906.27.F59C28B Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by imf27.hostedemail.com (Postfix) with ESMTP id D754840009 for ; Thu, 1 Dec 2022 13:36:51 +0000 (UTC) Received: from pps.filterd (m0279867.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2B1CHwf2002873; Thu, 1 Dec 2022 13:36:45 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=qcppdkim1; bh=IebuVfQptVmMCbqGFzsn28dDo62oICYBESe0AwhGRwk=; b=naJPar690wdJ5NSgqyFWyoUYX6HviVRArEMkx/ietKOJM0Nlo2f0QLnZxamJ/HmkexTj VZeZZOxICRE3A7BmJFRE1tmXZJQPnRhCQsSJecVMunAEIFnwl9tkxYp11P8/yrjze6r2 XqAWIztj5AvGWfMlQgj+KjuOlxeUXZVgINkYaXFOy/8TS7h0KuPBkB3f3YFlqxSFCHwc us64V2z2iDPuvN4TFX6bN3T+2vt08CE40QxMgq8OLJcr6l7zGL4TSkTFP9gGuAZNasUn TdepsRJD2QpK3Iud96UqSQwDLxkucJ/XvQjace7gjhZlUmlOOoyJr5cm1hF9Up6vWpnW YQ== Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3m6k2ksmnd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 01 Dec 2022 13:36:44 +0000 Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA02.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 2B1DaiqK030704 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 1 Dec 2022 13:36:44 GMT Received: from hu-pkondeti-hyd.qualcomm.com (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.36; Thu, 1 Dec 2022 05:36:41 -0800 Date: Thu, 1 Dec 2022 19:06:37 +0530 From: Pavan Kondeti To: David Hildenbrand CC: Pavankumar Kondeti , Andrew Morton , , , Suren Baghdasaryan , Minchan Kim , Charan Teja Kalla , Prakash Gupta , Divyanand Rangu Subject: Re: [PATCH] mm/madvise: fix madvise_pageout for private file mappings Message-ID: <20221201133637.GC3980@hu-pkondeti-hyd.qualcomm.com> References: <1667971116-12900-1-git-send-email-quic_pkondeti@quicinc.com> <906b0150-ef7c-d2b9-783f-4e94c48fa367@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <906b0150-ef7c-d2b9-783f-4e94c48fa367@redhat.com> User-Agent: Mutt/1.5.24 (2015-08-30) 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-ORIG-GUID: XJqGYbufGBpF-loKW5gpIbqp1tjogzP1 X-Proofpoint-GUID: XJqGYbufGBpF-loKW5gpIbqp1tjogzP1 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-12-01_04,2022-12-01_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1011 mlxscore=0 suspectscore=0 bulkscore=0 lowpriorityscore=0 spamscore=0 adultscore=0 phishscore=0 impostorscore=0 mlxlogscore=542 malwarescore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2212010098 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1669901812; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=IebuVfQptVmMCbqGFzsn28dDo62oICYBESe0AwhGRwk=; b=5/0cs+Rm9J//JP4kHTfoyJRO5Gt94cv0qe8Nmgin2Jc6pHm1W8SbyEaIrKzJtSmRTOWEzO OrIZpxbhb2su//s9ND2fRKWQoWWnlhjz6kLjsH7uouAEfLqeNTMQ4cJ2GGt40/dKOt2eMO PGgLHICPvzMf/DOoa7DFq+4bsCvGaJo= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=quicinc.com header.s=qcppdkim1 header.b=naJPar69; spf=pass (imf27.hostedemail.com: domain of quic_pkondeti@quicinc.com designates 205.220.168.131 as permitted sender) smtp.mailfrom=quic_pkondeti@quicinc.com; dmarc=pass (policy=none) header.from=quicinc.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1669901812; a=rsa-sha256; cv=none; b=Lt0XTOh9vyRJO6xt6s0BU27t34ALbgFIDuM/91BaJycgw2JRuHLMbbP9mTgN9sXRgSCBaB Isihc3s30l5RnVJuxzIbC/K5/Xu4+m7GAYll4SybFSiDEinzXZXJ4jxfL5IHsGfMtT/pYE e4WWQv3OIqbusruQQh1xctRvQdV69mk= X-Stat-Signature: en4t3h5bkk4b1who3nawfwsno6d19jnp X-Rspamd-Queue-Id: D754840009 Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=quicinc.com header.s=qcppdkim1 header.b=naJPar69; spf=pass (imf27.hostedemail.com: domain of quic_pkondeti@quicinc.com designates 205.220.168.131 as permitted sender) smtp.mailfrom=quic_pkondeti@quicinc.com; dmarc=pass (policy=none) header.from=quicinc.com X-Rspamd-Server: rspam06 X-Rspam-User: X-HE-Tag: 1669901811-405729 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Hi David, Thanks for your review. On Thu, Dec 01, 2022 at 02:01:22PM +0100, David Hildenbrand wrote: > >+ * If the VMA belongs to a private file mapping, there can be private > >+ * dirty pages which can be paged out if even this process is neither > >+ * owner nor write capable of the file. Cache the file access check > >+ * here and use it later during page walk. > >+ */ > >+ can_pageout_file = can_do_file_pageout(vma); > > Why not move that into madvise_pageout_page_range() ? Avoids passing this > variable to that function. > Silly me. I should have done that in the first place. > In fact, why not even call that function directly instead of storing that in > madvise_walk_private(). The function is extremely lightweight. Agreed. I will incorporate your suggestion and send the patch after testing. > > > lru_add_drain(); > > tlb_gather_mmu(&tlb, mm); > >- madvise_pageout_page_range(&tlb, vma, start_addr, end_addr); > >+ madvise_pageout_page_range(&tlb, vma, start_addr, end_addr, can_pageout_file); > > tlb_finish_mmu(&tlb); > > return 0; > Thanks, Pavan