From patchwork Wed May 17 16:15:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Khalid Aziz X-Patchwork-Id: 13245282 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 CB48DC77B7D for ; Wed, 17 May 2023 16:17:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 69583900004; Wed, 17 May 2023 12:17:07 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6460B900003; Wed, 17 May 2023 12:17:07 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 497FA900004; Wed, 17 May 2023 12:17:07 -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 39BDB900003 for ; Wed, 17 May 2023 12:17:07 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 8B53340656 for ; Wed, 17 May 2023 16:17:06 +0000 (UTC) X-FDA: 80800251252.04.D74EAE3 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by imf24.hostedemail.com (Postfix) with ESMTP id 26B6318000A for ; Wed, 17 May 2023 16:17:00 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-03-30 header.b=mOLywOmT; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b="sO/Rh1wp"; spf=pass (imf24.hostedemail.com: domain of khalid.aziz@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=khalid.aziz@oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); dmarc=pass (policy=none) header.from=oracle.com ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1684340221; 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: references:dkim-signature; bh=gLFYdWov4P9Tmx/yE5Yd5P2g0kOW3P+UFXo1n95NLLE=; b=hw2nk2I4sGs8yY4xUdwOVB6CRQG9VbmXLmktvllDSyTi47M8JGx+W2fagJ1IiNO75DJZp0 9GTVuD2Pap2oJeTn0COIqp9uCd3Soi8FTmRsoFR9g5t5IO1yYQumcz1zEJ24LlJ9UFG+5V 7zBLux+xp+QzMC/TKfjnA9pSVli33tE= ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1684340221; a=rsa-sha256; cv=pass; b=ufPFcvgbBmtpiq6/CpRe7cJneOfzC9h3uYsQexpvIgW+DzC8NUY0kZ6I6nPjIKwUhkg+yJ O+Rbq3rDGBBxkLM4KgfGSPFmq3DP/QyIJXohfUoWsrIhnP2Xtij7/C/uP/N9V26y9qNZ4E NrF/K2jvdoA+IFYt2av6rOo7dINwPnw= ARC-Authentication-Results: i=2; imf24.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-03-30 header.b=mOLywOmT; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b="sO/Rh1wp"; spf=pass (imf24.hostedemail.com: domain of khalid.aziz@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=khalid.aziz@oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); dmarc=pass (policy=none) header.from=oracle.com Received: from pps.filterd (m0333520.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 34HE4DtC032144; Wed, 17 May 2023 16:16:46 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=gLFYdWov4P9Tmx/yE5Yd5P2g0kOW3P+UFXo1n95NLLE=; b=mOLywOmTyy/CRwtcR3vHRJ6eVPFgpcTkxQRZG45GB2LBlO3+Xl1jRIRyidXVv8mL24gP bHoYYfcoNRMlhVU35eCacwxIv0SPxq+ARBOWma0l9lNn6nTIwJJUCOy0WvJwCNfIb7yd +kqg0FPyOcrC/QWsaVK3ihkCqdtchUQWYl2ynY1RbkKcN/YFE3mgd7luNTPa0UrcCfxm HH004iumUd/9mi4T3yDqCCsbqtX5f8YD1FDfMYG3u6cQGhFcgJf3ZzvjDHNIVOzMMO29 8WzU5bzG90RpKo4BDDvFm8K5zt1t13dY/H+pOysJ7gBLHqiz2NXz2nUbEEK96t9oFAAV mw== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3qj2kdpb7k-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 17 May 2023 16:16:46 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 34HFuB25036269; Wed, 17 May 2023 16:16:45 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2105.outbound.protection.outlook.com [104.47.70.105]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3qmm02mvs0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 17 May 2023 16:16:45 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AeaZFj5GGPqjbKxqfJ2dkhxPXNTF+XjIQ6Zbdm1SxSdsigxNKIVAsn6h7oT6VaCfOK8QPlTRJHEIRTHWv/Du6Xnbj9wg46UAXIzQ6R5i+pXCyW+6vhaaS7loIyzZ4kbcHZAwfGMF+zOYdBpujvVl7t8BxjtIiiKJiHrqmP4rjRXYcwvnY/D/wrUS6wxBP1VCx+E3++7cix33XqiS74QJLEIwIkiW/BVDJdsOUsN/a/xqEjr78P+5nPI0v37QIHyLDNVtIwU0sXMMjJ6XGkB3yd3/yWb5fFNUQgAD60AKy0+EN3iTlJ8KOGtOLHL8hzo7AZH58TP++DPh7Uu2s5+O7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=gLFYdWov4P9Tmx/yE5Yd5P2g0kOW3P+UFXo1n95NLLE=; b=koc64ffzwNX5xQrO5HyHWf940ARs3m1G8UNY922WsB3IJ6u8t3deT5vPDLLkfAfq0jAPpQig4+8zvF96JDuuQhM0M3HGiXurToZdqN2EIKR+gD/An3W2sqTciaHpxdLRFgGzM7kCOrgiiO28rIiFgoBFZhDEoLgDkRn2xikIm3bGF0aoCf9Kfa2guPsubvtiEvn0+ZFeAJzX/Dfs9/Vv6Chu4jshl9pwRJkGMpIQE91JosXNtxK6UzvRs86IurCYqeDl7xEDrIKRXJzT6wJGRDWSXuJIdvHqyiHqj8yKTMIDA2Q9jG61wtJ7ukmaJL/tzqpzI01c71OsAxDJISQhPA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=gLFYdWov4P9Tmx/yE5Yd5P2g0kOW3P+UFXo1n95NLLE=; b=sO/Rh1wptsV6K7HOuYQK8Iuhr/2d4xBIbVEKbYv1YNqwys7XsDsbINL1t3GR1qC38/rF92O8SKOn1FFAn8G22AwuJ2U+fWofCFEryEMe1xLM50rbtp8XjMLNf0tfqdDnt5fkXuBaqoEEvBm4ItUPXaDiAGFCLSqn8JsLeSwMQJE= Received: from CH3PR10MB6810.namprd10.prod.outlook.com (2603:10b6:610:140::15) by DS0PR10MB6078.namprd10.prod.outlook.com (2603:10b6:8:ca::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6387.33; Wed, 17 May 2023 16:16:43 +0000 Received: from CH3PR10MB6810.namprd10.prod.outlook.com ([fe80::ba49:e5dd:6a80:37ae]) by CH3PR10MB6810.namprd10.prod.outlook.com ([fe80::ba49:e5dd:6a80:37ae%6]) with mapi id 15.20.6387.033; Wed, 17 May 2023 16:16:43 +0000 From: Khalid Aziz To: akpm@linux-foundation.org Cc: Khalid Aziz , willy@infradead.org, steven.sistare@oracle.com, ying.huang@intel.com, mgorman@techsingularity.net, khalid@kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH v3] mm, compaction: Skip all non-migratable pages during scan Date: Wed, 17 May 2023 10:15:54 -0600 Message-Id: <20230517161555.84776-1-khalid.aziz@oracle.com> X-Mailer: git-send-email 2.37.2 X-ClientProxiedBy: DS7PR03CA0264.namprd03.prod.outlook.com (2603:10b6:5:3b3::29) To CH3PR10MB6810.namprd10.prod.outlook.com (2603:10b6:610:140::15) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH3PR10MB6810:EE_|DS0PR10MB6078:EE_ X-MS-Office365-Filtering-Correlation-Id: 95c525c8-dc09-414b-02d8-08db56f21a4a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 09gs4wGan2yfGD6r6hfjNS9Aau9RmN6gszZSLAERVeO1u0wcdAEX286Oxg55bCYG++gCjyC7tPUMuBNHEkqfymFRDs/A95d9/dm2zXzwbRE9luZdO06xoam04iQITO58FSOn2OH+q7vcpJfXrBYjGJWqupAg6SIruxi2Qbw8kJzSwmNOXSbq1jm+W91R20bvr5V8U5dG79QEV81wcPCQX6VoH/agTl+qJAZKWYOi9IKnkLLApm8oj8IZw+sj3Pmfd6WFg4z5yNrU1cmPhphcPShxGFtm+yi8tMSmaFQ2/0apDYZi0tM5GTQgQH0gOqh8pzvjGbOZn7fDer/kQ8BX25QCtohI8QfCoFrvymdZSQ1BPaeXhBQjHROeiv1VsqG7+nzjSTnabwC/kz5pR/rdXBcVc+CdGCCBf+J9++TPqEZMqcyFroj0qLVmTP+/xVOJWIV6C7gU/sCSSvRIdtg/zzghbLCJEciSirMEClMuvMMvAKJxEQfDAFTn7rukBjQgu/6Ji1XcY6fbl9O7Jza/lyvP5XgmxkiJzHnPpgkVwG4V2lu/qYY5IUmff81d36vZ X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CH3PR10MB6810.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(366004)(136003)(376002)(346002)(39860400002)(396003)(451199021)(5660300002)(8936002)(44832011)(83380400001)(26005)(6512007)(1076003)(6506007)(2616005)(38100700002)(186003)(8676002)(6666004)(41300700001)(6486002)(478600001)(86362001)(66476007)(316002)(66556008)(66946007)(36756003)(4326008)(6916009)(2906002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: d2HZEtPhD1q16nKxjbNxCopL/LGdP6oIRlFs5INkAU0/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dNCHa6JwVvfsPsctdMsoOMaec5vUEfpFkPS3YXfTU2YiRFKkqwQTaZCO15JOOxKMk48Pvr1AtBShT6SkDyFT/zDJvnIozXnGkXDvX914POqpP9TSq6TUF+8JVfsiR8tmdiYOwabNDz8i+9ujX2GXV1hOvkOLWxltedhMCXIJzGr9810P96bTLYQZV4LiGlxnnJ39klQqPTfl2ZcYIXlLSi71ACHzQZ5gs3AyOjNuZFQ1qNZrPsEjhunZvcUaDYbBmdQz8+IWRUnKTu0GyzRtCCzhrSyhsTI0uWNDyYXhlqbNqMeWDz4GtkAUQsMhIPz1q2dt/4h99vpTUcONnS+TYb5ySqSM3ZrKEfpKUl1VsoRpMfnlSRuM+FSy9oJ5QcwqLTnLNvF/bPgUv72ilDDDviwGSFmoOA+nxK8ZhW44zh94H9isJXlo8R05Saxx+ElgKcctRq/JW3/pB5rk= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 95c525c8-dc09-414b-02d8-08db56f21a4a X-MS-Exchange-CrossTenant-AuthSource: CH3PR10MB6810.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 May 2023 16:16:42.9735 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 39PGTT8pTsZUhs2u0A53voVf9hipnrnRTqL0UNPgP8laoRrCLO4hFkhRDvbvyNAJZ+kq1GjsK51UK85hs2bmAw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR10MB6078 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-05-17_02,2023-05-17_02,2023-02-09_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 adultscore=0 malwarescore=0 bulkscore=0 spamscore=0 phishscore=0 mlxlogscore=957 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2304280000 definitions=main-2305170132 X-Proofpoint-GUID: sVVNSOqX_q6gjOUHavRZBMEX0Zu8JHVA X-Proofpoint-ORIG-GUID: sVVNSOqX_q6gjOUHavRZBMEX0Zu8JHVA X-Stat-Signature: w94u7xc5riey5duc5fe86srehornts8f X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 26B6318000A X-Rspam-User: X-HE-Tag: 1684340220-962448 X-HE-Meta: U2FsdGVkX1+5+Au8Emz7L6KKpS+IZdmoRMONqmXG8huROpzqJDvKE+JgPGYeuAfR9HJBS4EQgYFhFIAegWKuNuvCjJBemGam73vWGRJYT52v60dK2EGd4DjRownb3bKz2pgqdgVX047SyV64ltu4sa7GzkatkbdPmrfXODiYFOW6P9WPgz5U/e70aHqbxSzTmUw5TjOjAFmvojOhksrxn0/clvmHZKZRKvGAs7nXK6y0blzlRmkdP4hJQ2JLS158bMXA5MR4bs1ev8AVlgWXd//92rkFqfdsCqok1CsozsrEf1Kv1DcpOjZoWl2TRkm+EYXgENe6/6c9giN5Bd2aNvLlUL0x6KA4RzAR6d+L+fWhqXYvRbcAptBfK9t9YCP++wDIrIrVXSB9qpLc1+q+YifV9Pd23aeH93QGXtkGA4V7n789Ivg1/eswn/g6VHgppg9QUHbfXiHjZNFkaXiJIJlHKEJKxbATmYAQePHHxWoJER/ouZLX0oTZb/IKEVR3I3NTTnXHCPiH00HJoNd0bNEBA3Xx9CJ1JX5cX7uKuwcGJLpu1RtmNRqd90gCrD+/5SejP6fDfXPRrA1POG6mwwDeURLjbUiy/9rZGUHTihqtwYjVVHfEmShkKfoUvhWYSURzS6f/UKlEGks5j1/suhc8WyYyMF1CsNzxeeb7glxRnn+Dd1URc/cwRZ2kw5THmUBUzMLs0KUy3kM0P/r53GjvEK2Wc/YxhOnscNPm3WeNtsVi3sJVM2On7wEEpCqrucB+A7rLF1yWg1tVXpi5r8bqG/WG32vJlcvsKxAzpxRer6MCOFOKqn61aZxd70K4KVYmhp0WF5UsvtOv8bQN46pNV8nrNncwo43qDtplSnMYTlxwTkyeVsXr+FDKLnqzjOT26iKWGW7XlroYgVBE0fWXtrHwnkjlt/CIaAocfCKVNq6zhPRZmHS/Mdb0IrM7hVSv6Q6YrxzGjiIbBF1 vr79x5ES w4oiMvOElwPtnTZOMVlO0FMvy4l70D6VHWEXx05kzdDShu1hk9mjwrLDOI8IHvKWOCFgPDpQ495mIrgxC5qE9Lty/YWWlVlroHyxUf86gP6EljoeznBBjHVLfPIqfXceUcci5Zeu2RHXmQRIWgJn2H0oBXvYhRuVULnmt0nO7oE6f3yIlENC6u9m8hu4VwyjV+BC5uqdgdH/O58zKoTKlnIN60vZKjEmabSnF2XP/KYftmLSgo+bSsJa1mchDHBydTzeIWNt//7fRHUzdX7G7pQDJw3w3dehee2xLYEmHVipSbuGlXJPCAS4iBwqQsGyhA2LCDgQ54qJYxXNud+nGNA2V9UkuDsKu+gEQjpQMMfROQoI0B7MXte/8gQOMIes/uP/9 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: Pages pinned in memory through extra refcounts can not be migrated. Currently as isolate_migratepages_block() scans pages for compaction, it skips any pinned anonymous pages. All non-migratable pages should be skipped and not just the anonymous pinned pages. This patch adds a check for extra refcounts on a page to determine if the page can be migrated. This was seen as a real issue on a customer workload where a large number of pages were pinned by vfio on the host and any attempts to allocate hugepages resulted in significant amount of cpu time spent in either direct compaction or in kcompactd scanning vfio pinned pages over and over again that can not be migrated. Signed-off-by: Khalid Aziz Suggested-by: Steve Sistare --- v3: - Account for extra ref added by get_page_unless_zero() earlier in isolate_migratepages_block() (Suggested by Huang, Ying) - Clean up computation of extra refs to be consistent (Suggested by Huang, Ying) v2: - Update comments in the code (Suggested by Andrew) - Use PagePrivate() instead of page_has_private() (Suggested by Matthew) - Pass mapping to page_has_extrarefs() (Suggested by Matthew) - Use page_ref_count() (Suggested by Matthew) - Rename is_pinned_page() to reflect its function more accurately (Suggested by Matthew) mm/compaction.c | 36 ++++++++++++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/mm/compaction.c b/mm/compaction.c index 5a9501e0ae01..f04c00981172 100644 --- a/mm/compaction.c +++ b/mm/compaction.c @@ -764,6 +764,34 @@ static bool too_many_isolated(pg_data_t *pgdat) return too_many; } +/* + * Check if this base page should be skipped from isolation because + * it has extra refcounts that will prevent it from being migrated. + * This function is called for regular pages only, and not + * for THP or hugetlbfs pages. This code is inspired by similar code + * in migrate_vma_check_page(), can_split_folio() and + * folio_migrate_mapping() + */ +static inline bool page_has_extra_refs(struct page *page) +{ + /* caller holds a ref already from get_page_unless_zero() */ + unsigned long extra_refs = 1; + + /* anonymous page can have extra ref from swap cache */ + if (PageAnon(page)) + extra_refs += PageSwapCache(page) ? 1 : 0; + else + extra_refs += 1 + PagePrivate(page); + + /* + * This is an admittedly racy check but good enough to determine + * if a page is pinned and can not be migrated + */ + if ((page_ref_count(page) - extra_refs) > page_mapcount(page)) + return true; + return false; +} + /** * isolate_migratepages_block() - isolate all migrate-able pages within * a single pageblock @@ -992,12 +1020,12 @@ isolate_migratepages_block(struct compact_control *cc, unsigned long low_pfn, goto isolate_fail; /* - * Migration will fail if an anonymous page is pinned in memory, - * so avoid taking lru_lock and isolating it unnecessarily in an - * admittedly racy check. + * Migration will fail if a page has extra refcounts + * preventing it from migrating, so avoid taking + * lru_lock and isolating it unnecessarily */ mapping = page_mapping(page); - if (!mapping && (page_count(page) - 1) > total_mapcount(page)) + if (page_has_extra_refs(page)) goto isolate_fail_put; /*