From patchwork Fri Sep 9 06:18:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhenhua Huang X-Patchwork-Id: 12971045 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 838B7ECAAD3 for ; Fri, 9 Sep 2022 06:19:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 22EE48D0003; Fri, 9 Sep 2022 02:19:10 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1DEA88D0001; Fri, 9 Sep 2022 02:19:10 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0A69F8D0003; Fri, 9 Sep 2022 02:19:10 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id EF5158D0001 for ; Fri, 9 Sep 2022 02:19:09 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id C652B1C614F for ; Fri, 9 Sep 2022 06:19:09 +0000 (UTC) X-FDA: 79891544418.18.0B76985 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by imf31.hostedemail.com (Postfix) with ESMTP id 6ADAE20095 for ; Fri, 9 Sep 2022 06:19:08 +0000 (UTC) Received: from pps.filterd (m0279864.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 2895MhQV032423; Fri, 9 Sep 2022 06:19:07 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : mime-version : content-type; s=qcppdkim1; bh=Rbe3gHAZin8xv/l2dMncL1rLyOGEk16vwitFsR0nsJk=; b=R9lweI6MgpgHdlZzouTRQfVHJiWn6HRxokpxwDtXDOML6NYNz1xqP45GZs+t1whXyYNU 6Tar1tfNhY3Tk0o+21wejtbs6ML8fqUriZwGQg/LhBMRtbHosjXaY5B84wdu8ye4+wZv 62kWmX9TaRIy25E3SF6Qev6LEq/LkgXC8rbTbN7jO2qvzSDBGEAu3+p/Cf2GodFqbMiq 2esJsYwzAfjw5WivEVzhJMXb5z7XgyOY5CewFrVrOxsp1hfwKnXPCmybfAZCgdV/XZl5 di9gRD0T0PsmsnwiQbNAwFV81LNJks9bYaus5jIJNU3tPwcx56oxdZQ2EApgig1nchdr uA== Received: from nalasppmta01.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3jfuww8h3c-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 09 Sep 2022 06:19:07 +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 2896IxB5029470 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 9 Sep 2022 06:18:59 GMT Received: from zhenhuah-gv.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.29; Thu, 8 Sep 2022 23:18:57 -0700 From: Zhenhua Huang To: , CC: Zhenhua Huang , , Subject: [PATCH v3] mm/page_owner.c: remove redundant drain_all_pages Date: Fri, 9 Sep 2022 14:18:46 +0800 Message-ID: <1662704326-15899-1-git-send-email-quic_zhenhuah@quicinc.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 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: 6MBvOQps051RLlX3eqRtqE6rio-KTHQR X-Proofpoint-ORIG-GUID: 6MBvOQps051RLlX3eqRtqE6rio-KTHQR X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.528,FMLib:17.11.122.1 definitions=2022-09-09_02,2022-09-09_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 malwarescore=0 priorityscore=1501 spamscore=0 lowpriorityscore=0 mlxscore=0 clxscore=1015 bulkscore=0 phishscore=0 mlxlogscore=999 suspectscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2207270000 definitions=main-2209090021 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1662704348; a=rsa-sha256; cv=none; b=7S5gaBhNN8rQ1J+O0xMI/0dA+YE0vj6wZWRin9ydKUzKRH+JI9M15z4DWS0qjDi3YsE3H/ 97ITO1uDA3phVpEU2qp6d5I15zTo3wMvB/l2Hd3g0oHTzG5DzJIngTWzGBbOElPMaqGQNH eDHr/AA+7YaDsXaxY4D79R7X/ExzSac= ARC-Authentication-Results: i=1; imf31.hostedemail.com; dkim=pass header.d=quicinc.com header.s=qcppdkim1 header.b=R9lweI6M; spf=pass (imf31.hostedemail.com: domain of quic_zhenhuah@quicinc.com designates 205.220.168.131 as permitted sender) smtp.mailfrom=quic_zhenhuah@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=1662704348; 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: references:dkim-signature; bh=Rbe3gHAZin8xv/l2dMncL1rLyOGEk16vwitFsR0nsJk=; b=lE2JyfCQ0bg6J/Y8dNwWdz4I1cSJ68MQUSNjyExfovSS+376zfTNgO7op6+12JOQAIsOby YjB12U/uVDdPz9LnOR9KfknHRkpg7guZDPk14IOdTn0ddAL9FhqbNt1HlawHBqNTPr72cO aw5lXr00xfaSErRhSc3CsAKW/cXAInU= X-Stat-Signature: 7z5ityroa7n1ffxzhjsg3udfq6qbrkey X-Rspam-User: X-Rspamd-Queue-Id: 6ADAE20095 X-Rspamd-Server: rspam07 Authentication-Results: imf31.hostedemail.com; dkim=pass header.d=quicinc.com header.s=qcppdkim1 header.b=R9lweI6M; spf=pass (imf31.hostedemail.com: domain of quic_zhenhuah@quicinc.com designates 205.220.168.131 as permitted sender) smtp.mailfrom=quic_zhenhuah@quicinc.com; dmarc=pass (policy=none) header.from=quicinc.com X-HE-Tag: 1662704348-456620 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: Remove an expensive and unnecessary operation as PCP pages are safely skipped when reading page owner.PCP pages can be skipped because PAGE_EXT_OWNER_ALLOCATED is cleared. With draining PCP pages, these pages are moved to buddy list so they can be identified as buddy pages and skipped quickly. Although it improved efficiency of PFN walker, the drain is guaranteed expensive that is unlikely to be offset by a slight increase in efficiency when skipping free pages. PAGE_EXT_OWNER_ALLOCATED is cleared in the page owner reset path below: free_unref_page -> free_unref_page_prepare -> free_pcp_prepare -> free_pages_prepare which do page owner reset -> free_unref_page_commit which add pages into pcp list Signed-off-by: Zhenhua Huang Acked-by: Mel Gorman --- mm/page_owner.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/mm/page_owner.c b/mm/page_owner.c index 90023f9..54f3e03 100644 --- a/mm/page_owner.c +++ b/mm/page_owner.c @@ -524,8 +524,6 @@ read_page_owner(struct file *file, char __user *buf, size_t count, loff_t *ppos) while (!pfn_valid(pfn) && (pfn & (MAX_ORDER_NR_PAGES - 1)) != 0) pfn++; - drain_all_pages(NULL); - /* Find an allocated page */ for (; pfn < max_pfn; pfn++) { /*