From patchwork Fri May 12 19:00:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Khalid Aziz X-Patchwork-Id: 13239652 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 EB2E0C77B75 for ; Fri, 12 May 2023 19:01:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4FBF7280002; Fri, 12 May 2023 15:01:51 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4ABA1280001; Fri, 12 May 2023 15:01:51 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3266E280002; Fri, 12 May 2023 15:01:51 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 2231F280001 for ; Fri, 12 May 2023 15:01:51 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id DC659A102C for ; Fri, 12 May 2023 19:01:50 +0000 (UTC) X-FDA: 80782522380.08.3376D7D Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by imf21.hostedemail.com (Postfix) with ESMTP id E82671C000E for ; Fri, 12 May 2023 19:01:45 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-03-30 header.b=sKtxrqlK; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b="J/vVwhMU"; dmarc=pass (policy=none) header.from=oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf21.hostedemail.com: domain of khalid.aziz@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=khalid.aziz@oracle.com ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1683918106; 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=6UMyziWN70NXLZyyndT1rOtXcbcEJJFo/akBpk6OYoU=; b=ynfMaYisVcDgQLDVRGldjYORejaIsG/Jj85Chqip6NKuIXx4rV9juHboQsVchSQdJVtmW0 OW66bvLdftGiXVvhNW/zWj37WBql2Eoo7e3qYBL6VgLkSSbiTUmQ8A+H3754loy3cRVpWs c9QCDeO6i98JMs+UGqrrQH03L/1gWFI= ARC-Authentication-Results: i=2; imf21.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-03-30 header.b=sKtxrqlK; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b="J/vVwhMU"; dmarc=pass (policy=none) header.from=oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf21.hostedemail.com: domain of khalid.aziz@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=khalid.aziz@oracle.com ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1683918106; a=rsa-sha256; cv=pass; b=JKB/hbiIAoOU68l13Rf4nzZHh5zDLfrcLygkFXyLlf47+UccayPpvdXDxJsf5hSxySMREk bczCDA9/uUoNjBDFoKAoSL14q3kI47U43EJoAYIr0H54mqPeVIDIpAZGMaerZv4Aoi8tTt VQEVqAYaUbvYcPX4u6fl8g6pnKHPW+E= Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 34CIoQkV023033; Fri, 12 May 2023 19:01:35 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=6UMyziWN70NXLZyyndT1rOtXcbcEJJFo/akBpk6OYoU=; b=sKtxrqlK4XuJaMKIYgggmujXB1CJaGFMAhm8Uw+IomNByENVEWpoJ2/UGroCLsAl0d4L SLPiJbRNoU0wRDoMxSVIXnyFoAYk3R9BJqPYpf+WScebSn17Oiy/WWC13ryzlFdZQD88 ItA1I806V1Lt8tWwBA3Ru3ArYG+J7CMTl1MtaRf+3OCsadnyVBdYMFEKIcgqhchRnt1u bt0WHjmQNTBjO7KrAxqQ/mFEa3mdUAna+FhE9qyISuNVlKOkPAifjYHd2DPhaE9jpCan TaPVqAsz8u/Zqn0LOEQLYd/HQh4zrDX0kKci24Nme3RpjObFs2c+GQwkTorUH9nXUpZS Dg== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3qf77gbuk6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 May 2023 19:01:35 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 34CI8S1S011705; Fri, 12 May 2023 19:01:34 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2109.outbound.protection.outlook.com [104.47.70.109]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3qf8158c3a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 May 2023 19:01:34 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HC3T7C/D9V33AfO8TIMUcmit9eCSqemjmM2FLTB/nWPpEYqi2Va4ZvYapkoXXnU5+YsJXbrxortUgQ1PKYaiElnlIL5IPne0zSZgfORm1PpLDfEE6vTK1BQcNDJnVvZfD56GamVfXnXiAywir4Dzb42WEwQv4QIe+MW9dNX6zNtj/74arSFhqU6WmFcCM8qnaIQODyoR1zkgLdjWf9hCvbmMCQFY0ZpRFXF1lQXXwIDpJNdb9loNlz5lYozpUbwEYzk0OMyHI41DB+wFGGjnDoRIh+XbHe1gS4pQY5W/DfNBqIM3ugDdwgQhSWglb7V34/K1McSk1c8WWB0CncrAkw== 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=6UMyziWN70NXLZyyndT1rOtXcbcEJJFo/akBpk6OYoU=; b=foQfHOc0L6PXnjPnK36koOODzdV5wgJ/AL5cL4yCsLKMeuy2MYgYPiGLeAwX8UR2cC3c2wP7pyuNbahvpbQriiPZ2LFQiKzkfYYgydSnULFY4P/+kkCF1wX6mqygd7XIsjFNwF/SxDjWwilRgHUk0elGYg3qF1D7037M3ymXPRNeLghK0c6RcX85/twwuLDEJ0NYHdVBemrWJj+zG0p//KDFaYo/wMq4JHpP9jUPL8pAhDouEL6KCOlqLtpaS8PmI6Ol9Ig2X6U2O+0Ndbe4R2fukrOGjTLa+tICNpzgdcPZyqhseVCWPHG2hc7sini5SNAraCLpTDSNgQ6xGo8bsA== 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=6UMyziWN70NXLZyyndT1rOtXcbcEJJFo/akBpk6OYoU=; b=J/vVwhMUGSFy+0jkezklHyCSKyE46qQqsoTz86ueeoN8YsHBZy6Hume8iU/ewGcQtKlgbmY5ekU9d4FLsrSzwHPKIl5j9uRC5fTvQq0RzmYJW4VspzlL/CqscYMdGnCJor0Hs4Qfwiyz3cRVwDEPjIAkddnETK5RrCzukJPe3+g= Received: from CH3PR10MB6810.namprd10.prod.outlook.com (2603:10b6:610:140::15) by DS0PR10MB6973.namprd10.prod.outlook.com (2603:10b6:8:14d::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6387.22; Fri, 12 May 2023 19:01:31 +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.018; Fri, 12 May 2023 19:01:31 +0000 From: Khalid Aziz To: akpm@linux-foundation.org Cc: Khalid Aziz , willy@infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Steve Sistare , Khalid Aziz Subject: [PATCH v2] mm, compaction: Skip all non-migratable pages during scan Date: Fri, 12 May 2023 13:00:00 -0600 Message-Id: <20230512190000.103737-1-khalid.aziz@oracle.com> X-Mailer: git-send-email 2.37.2 X-ClientProxiedBy: BY5PR17CA0003.namprd17.prod.outlook.com (2603:10b6:a03:1b8::16) To CH3PR10MB6810.namprd10.prod.outlook.com (2603:10b6:610:140::15) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH3PR10MB6810:EE_|DS0PR10MB6973:EE_ X-MS-Office365-Filtering-Correlation-Id: 46ab2c8d-ae33-48e8-05cd-08db531b4c72 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: h1HQS4ghQ65iwxJ1igXAG5yRZ1DqqOSlZvr2Tbz77TEcR5ZU/TYUizVd/k4VF4Fax4dGMJcweBssPVBtAUWyr0pfnsGTOWlnucri9gzizq66bvcc+vmrEBkCL3j9pUUfdSGafs+/IZFiBoAZXGIAfb73f9tGUplcmGjp4Sjy+S9RphFV40xCtaxsYvp1JwBMG7CC5BzwEP7ox6FsY5b1kL9U+bH5yufn2wiqFdy1ir0JyUCRynZoRqSRREv00MLMSCroXLnDdhv/BEzJDv2kyaDoh5WvXfY4l3amXvilmI4evUcfJAzK1oz781G6XfoYKZqj0ZbgNvVdNCQFxZxC5hz/y4LQgjLK8xx12KNA4+LVdigZYn0Vi63RrHRgkQVw5yoGYq53u1A62m4vStAQ/c7kKkMGHdz+Dqpzi8LcxbRIRddGh33tzL7//PgYnGICBOYe3qo4grTb8XuyZ4OCBJciOAOpPmfbBKo3HhFp/bNu1ttRZWs+Bq6arpswbQIBbAvjiuzwu6dUJ1fwYOhNx3UQtC+lgE2SZ/pGYBAbtyntt0ksrrKiB0Qrf6k5iELC 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)(396003)(346002)(376002)(39860400002)(136003)(366004)(451199021)(26005)(2616005)(1076003)(6512007)(6506007)(41300700001)(38100700002)(83380400001)(6486002)(186003)(6666004)(478600001)(54906003)(4326008)(6916009)(66556008)(66476007)(66946007)(5660300002)(44832011)(2906002)(86362001)(8936002)(36756003)(8676002)(316002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: VZ7d8BBzvuBq1cPg3kTgBmUTGn+NKmvNOFzT7NGomSEArmvbs6aJVY+aHvwlmtOlJPH7N4z+f7THDPLjsfAt0s/o7eQIed65jkxMaMfSSOlQnIRJH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i/hye0I6DbpxcFghen6Hh5ZEryIfAYi3fbDJQt9BGmyRfKE1glKSYbcZgXtg9LVni2mY2Wt7U/FgrEqk97MgQEVKjfG96omz2EU4hSb6XUBrmVBCds6Qxm+AZx+JS6J2l7r6jQJmx19seHAkqGtWeIyihzcVux84UjgvypYFmZNzNELvUqfpptO5O8FPh/II8u3W6TJgBeAZGurI2AoBaCtWyDerpPTkbcNCisMJ/rjpVTilJpNp0I78J4PawNqwxjKv9+boLR4mjo/PnXaTeNqYGi5nPWZV6VJDUP/pIzSFPSU22oCDWwL/jiVvYeiyPES1mdQFwc0s622OmrUXM= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 46ab2c8d-ae33-48e8-05cd-08db531b4c72 X-MS-Exchange-CrossTenant-AuthSource: CH3PR10MB6810.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 May 2023 19:01:31.7358 (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: LqzOoL2XbqZT6aw3CwwFt0ZXB1SZPnUvSE9VmSLah2r7S6GlQyFod3aEfPp/51jjZba18ehgjS6x2qAssKMeaA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR10MB6973 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-05-12_11,2023-05-05_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=830 phishscore=0 adultscore=0 spamscore=0 suspectscore=0 malwarescore=0 bulkscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2304280000 definitions=main-2305120159 X-Proofpoint-GUID: ftQTMl3oQCJlx8smriZW_67PA91T-Dcj X-Proofpoint-ORIG-GUID: ftQTMl3oQCJlx8smriZW_67PA91T-Dcj X-Stat-Signature: njrxoz3f6adiao8puqh14ygtb8mf4fow X-Rspam-User: X-Rspamd-Queue-Id: E82671C000E X-Rspamd-Server: rspam07 X-HE-Tag: 1683918105-584686 X-HE-Meta: U2FsdGVkX1/UuQP+3ffayRSTzg54TDor/hYblneLIrsBEH1Jsp2Mt7L7NKUN8ff/Y46UkYG7AySs35iURLqZAgAMIuhq5MhZOiLDff7hf/DM/CcQSCWvl88bv1nbUvTxq/YNUKgrCwfCa0T8ivwfq5kz7J0oybmubFO0QgWpf5NFoJiaMRBmMR9+gySBSv8eHtw0y+CRETk5a0TH0/8BkECgcDk41O8ySZicxLMo6tOZYtazQwMXNbsIIhRp6z26BlhAjOM1tmmm0j6bgbt3oRWR9aUL1JiQrjUMklPJ2eYFxiv0bDnq9PJNoMFVBeuKqPX+lPcxPg2y84xteQaRUjT/Sq0lHvnuDkS5WTVIaTP03X0ytGgQcuRYYLEZN4WNI3J2Jx/Wq6zebPATphNGPLaDy+1YnDaau02Pw6fUkBv2b5tG+cVex0lOPTndWakqTvqQpgYZemXPbh/xshsoBH4It1+mHqCSgQRrZjF42u5FuM0P38PvzfIgDuuSnZQY/WfKS55KAmbsrSkVwSQ9obwj6Ov4DKCUA2Oo2JqwZrvkNULefxJFh1tGWBe5qUM7t/kk8KIcFPVN34RaQE2TRpTTMCt/4HCVOjhtlyJLfhug3KgCWOsgofgrtzhRBWRMURlaJEutUedHuj60ROTzQfLnWuljoCWWuJd0VxYFY8EjS0+vEgKLzOoR2dypCH4vgHmAJmnAVZj+YU6Uz1mKcpoGmnV+vPowBhsYkNhn9wEpFFLJ/+2G5b8fsTcWhZecqjon5eU2McUFe0fHumY8J/CIo+bCQRs9YmbCWE0XrTv654t3+5b7pxrOuiBYwWVjm1HSkGda94GC+8Xks50wUNL+sT6klHtSVRl0jNG0Npmtd37U6KlLB5RWcvuXJEXXLWWtMEkHeXNtTt6uKkgJ972kFMFFiGSj2Bs4R95/On6OOJRfYwKwz0OXs+eF00rpgtd7chQJyVEqmA24OcS i0bt/ihK 6tLqQPKZO2p1P8AS1GwO+C8wVH2g5bIHvCg4JPikwrp97MQ3ezcuAWytuEAfB0WcqlH5Q7Jaf9OBxFATePuXitX9GKgoTrf9FH47502ipUB2eJwQ4m4AreE40bpVRkc4K8vx06lpgRErhoHslZ5HitY+G8tQG4OLwjdD33zz5LDY3NIosiK9DrJ+ZEaoFK92ZUjw8nZyGshF7QjjwAjstZpCVg+AJSOtSyYrtDedov5wMybMsU8FdMZw9eXI4cicW6kBV89BHAsL3sjG5IqJeVI/vpeAkLBPUZAvu8+vkL2VoZLeknY534bQYm8YM/ZvB79g4mt9kFG2iCKACJe9rl1N3f3DdOjxeS3q1r+vCIxmKylFGbSiiYX2eQ9BW18FhJqxM6HRNo9Pbwj/4cwHzTy/SuHfnz6ICJ6BX4Zkh6KyqqM8+QU6lWvaaeg== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000021, 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 kcompatd scanning vfio pinned pages over and over again that can not be migrated. Signed-off-by: Khalid Aziz Suggested-by: Steve Sistare Cc: Khalid Aziz --- 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..837f20df2bbb 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_extrarefs(struct page *page, + struct address_space *mapping) +{ + unsigned long extra_refs; + + /* anonymous page can have extra ref from swap cache */ + if (mapping) + extra_refs = 1 + PagePrivate(page); + else + extra_refs = PageSwapCache(page) ? 1 : 0; + + /* + * 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_extrarefs(page, mapping)) goto isolate_fail_put; /*