From patchwork Thu Sep 8 10:33:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhenhua Huang X-Patchwork-Id: 12969895 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 007F7ECAAD5 for ; Thu, 8 Sep 2022 10:33:49 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0E80F8D0002; Thu, 8 Sep 2022 06:33:49 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 097A76B0073; Thu, 8 Sep 2022 06:33:49 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EA2E88D0002; Thu, 8 Sep 2022 06:33:48 -0400 (EDT) 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 DD36E6B0072 for ; Thu, 8 Sep 2022 06:33:48 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id A952BA0AAD for ; Thu, 8 Sep 2022 10:33:48 +0000 (UTC) X-FDA: 79888557336.16.342CDE8 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by imf04.hostedemail.com (Postfix) with ESMTP id 546B34007E for ; Thu, 8 Sep 2022 10:33:48 +0000 (UTC) Received: from pps.filterd (m0279869.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 288AN8YB023163; Thu, 8 Sep 2022 10:33:47 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=qmlrRH7wJUkS01VdlyMwptwF2uDh6LzroEBpFXP4QVY=; b=DLhXHbE0yR9DhxgMTZvD8LShdyOP7Yp/a3yWBJCHSvnK8f+ZDwF2MqJCcXkbQSqsB4Vo jYsqUhxJCEIXEeNfyfvuNSWBnEh7qFJz60IMT0KFDum4LgWumbaRbSXrByFl24qa2voV BPbuwErXGKKE0HmU5w3YGZJ40qxjt4rrYhkopGDz9s/tFm8yYsMsV2Knhs2NK/PwIaW+ Y8/svf8u/KWRGvcT8ljEnDgd/FX9dn4PXv4334TrOY8vG6f0hsYksDVcsa5FxMttjcW4 Q/X4hKJrNV1e8BBTKrQdnCCbX/yimkrv1oGq/VkRlJpx70lyJ7/gjKLbcjvXPS8cZND1 8w== Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3jfdxu843x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 08 Sep 2022 10:33:47 +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 288AXkKu020321 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 8 Sep 2022 10:33:46 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 03:33:44 -0700 From: Zhenhua Huang To: , CC: Zhenhua Huang , , Subject: [PATCH v2] mm/page_owner.c: remove redudant drain_all_pages Date: Thu, 8 Sep 2022 18:33:24 +0800 Message-ID: <1662633204-10044-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: 7S3szQHI9hPGzcsJfnPcTQUYsKIvzD7X X-Proofpoint-ORIG-GUID: 7S3szQHI9hPGzcsJfnPcTQUYsKIvzD7X 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-08_06,2022-09-07_02,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 suspectscore=0 mlxscore=0 bulkscore=0 mlxlogscore=999 spamscore=0 malwarescore=0 clxscore=1015 adultscore=0 lowpriorityscore=0 priorityscore=1501 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2207270000 definitions=main-2209080037 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1662633228; a=rsa-sha256; cv=none; b=t1l0QVIYpQ5vQzNeJx3Fh5cwvZQHy/4I1oQZzInXLISm1L9c5VKV1jhw//hXQ5msi/wF2+ yGMB8PekVbPy3tmfT93hMk+XWs0jEk06LGbKkJJokqijXTgb9A5rJ+WoNWnzlUAxuD77N/ eFZwGw/auc5YGIx02tQp1TlqYCL5S3M= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=quicinc.com header.s=qcppdkim1 header.b=DLhXHbE0; spf=pass (imf04.hostedemail.com: domain of quic_zhenhuah@quicinc.com designates 205.220.180.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=1662633228; 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=qmlrRH7wJUkS01VdlyMwptwF2uDh6LzroEBpFXP4QVY=; b=j3Gthzkqa78LtMVODvm6QQ0hjDxJuL7rEyMt+NoWmscn0KtqS5YKc8wQFGlXM2AYVrrvtZ ycoTPkrc81CwCsEsiN2skMiJokUUjZMSGkRGKVGqeTEAZZ3YTCecvhQh4PhxDrH5tCAikV uM8r5leHlsttw/IsOKDqcf+LyLLZpSQ= X-Stat-Signature: wnuzaj7ayqt155j9q5yn78xxyaaw3mzy X-Rspamd-Queue-Id: 546B34007E X-Rspamd-Server: rspam11 X-Rspam-User: Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=quicinc.com header.s=qcppdkim1 header.b=DLhXHbE0; spf=pass (imf04.hostedemail.com: domain of quic_zhenhuah@quicinc.com designates 205.220.180.131 as permitted sender) smtp.mailfrom=quic_zhenhuah@quicinc.com; dmarc=pass (policy=none) header.from=quicinc.com X-HE-Tag: 1662633228-727492 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 Acked-by: Mel Gorman Signed-off-by: Zhenhua Huang 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++) { /*