From patchwork Tue Oct 15 17:56:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Stoakes X-Patchwork-Id: 13836810 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 D04BAD1D893 for ; Tue, 15 Oct 2024 17:56:35 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0A4DA6B00A2; Tue, 15 Oct 2024 13:56:35 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id F1CD96B00A3; Tue, 15 Oct 2024 13:56:34 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CD2366B00A4; Tue, 15 Oct 2024 13:56:34 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id AC7C96B00A2 for ; Tue, 15 Oct 2024 13:56:34 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id D044EA1816 for ; Tue, 15 Oct 2024 17:56:17 +0000 (UTC) X-FDA: 82676591298.10.E010259 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by imf28.hostedemail.com (Postfix) with ESMTP id 8EF35C0010 for ; Tue, 15 Oct 2024 17:56:23 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=gEo91h5x; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=pUGOMHTL; dmarc=pass (policy=reject) header.from=oracle.com; spf=pass (imf28.hostedemail.com: domain of lorenzo.stoakes@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=lorenzo.stoakes@oracle.com; arc=pass ("microsoft.com:s=arcselector10001:i=1") ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1729014944; a=rsa-sha256; cv=pass; b=50xEjvC9vhYeZPmrqT79pBmXeAMbZGpms+81OJcY6Dsqrbxteuh9idU9rf3NWoFXylHw7e +JoHqEySjiF9GUJNwJMW/Rf7L8g+Fso5wjwsdLIwqhzoRdUqigg2qtJ87CgAPT7nxi4QFr VfOul5fvFfP3m9eU+qu2rT9WmwRVgOA= ARC-Authentication-Results: i=2; imf28.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=gEo91h5x; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=pUGOMHTL; dmarc=pass (policy=reject) header.from=oracle.com; spf=pass (imf28.hostedemail.com: domain of lorenzo.stoakes@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=lorenzo.stoakes@oracle.com; arc=pass ("microsoft.com:s=arcselector10001:i=1") ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1729014944; 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:in-reply-to:references:references:dkim-signature; bh=05Vlkq3Xmq9GA1USXavexmhprJXWFzls7cqapKWzTvM=; b=HpDxMoRubPj8P7V5y07PnNSs3fMxjY71oo2MX0Z6d2940SRXfqNMtNwiJZEwUW1PGdCAPo lvjgku+u3u5YGNG0QuPSWXo+ueYL8Glo3+GG+0m3VJepw0vyca+fvJ1D2vu1ijaEx9qwXz jd9mpwVknZBS4sMe5WhvKNNTXEdLQtg= Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 49FHtfub008297; Tue, 15 Oct 2024 17:56:26 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s= corp-2023-11-20; bh=05Vlkq3Xmq9GA1USXavexmhprJXWFzls7cqapKWzTvM=; b= gEo91h5xsF7SKSEaMc2SaLhtbljG4MvGiKRH9NK+g7Qmz4FxFxPkJNupEY+vU+38 D/oWhCw1pVwGVoCIuZJCq1qymRcYzX6Q8EAof5h9beSCdAoRdQmWgywkd11GlYuu Qa/3ZnhW0bhh2M4aYax3Ld0/ytKid+obidVc1q7AsS3bXwNsuuYXk3904b9Dvn4J KhKJlBuOpx1099I7wg108Bs5+SfhKHvfa6y2yVBR9i8v3Sm591yaWhYNseRIAGXQ tZd7mzf9d6qzSYl6iSUL70yhpJX17vzNIt10SuSR59NS17GTiUiv2Y7Hfi6vAv1G aS6U9cHVS3jsLawTNvoB7w== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 427hnt9vjp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 15 Oct 2024 17:56:25 +0000 (GMT) Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 49FHQMhr026416; Tue, 15 Oct 2024 17:56:25 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2048.outbound.protection.outlook.com [104.47.70.48]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 427fj7swmd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 15 Oct 2024 17:56:24 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=eIdtnCW4T67xzUSM3jU7NO7nNb52ndpWTU8ZJF8M/OrAxDglB44inl7UuTp/laozKS+Z8L3z32y6gScu1C/thvTJWSkC0O7Cu47rVjpz+9wzqR54ZYEw6QbDT4IpIaEyazmaNrhtNtkBWn1gCXxHMXJZuBZpjHYWx/1t2GF5GlkSRanuEMHW8jl7g77+E1rLLq9za+Rf6OR8BzuJUa2c/6Q6W1RrXYAqSGVKxuSBSznYppIZ2+E0MAMpKMkxd+39/fhiDKmIVdyn7jN3sYULLZezd73L3tew+Jann7gwa/aF+Dcakt5yNLhoz0U5cRm8E2ZDGanOzfC1Zx+oDnjdvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=05Vlkq3Xmq9GA1USXavexmhprJXWFzls7cqapKWzTvM=; b=lEbH8LYjQ7en4NxxgOAVWQHcktUq81vYmboiQWZ8wVZF6wkEHMB7aweMkLcqY5z6JK7GogG3iOA5lHQ4qFrMD+c23j0a/3D9W8hshpX91qSWnbs09LLNVVfS6Qcybz3ISwxlz1CyBqxp2Kao/DlL4kXDpptSWIfYV6Lfrxomh6pLB3hmrRScfHo0f9e9X+GfD8E/tHMJ7eBnNVM8A5zl22h/N/Oii2LAbjISCQW7YBtXU8nT0q4kLWJkcubJJLDIpxcQjXl8v+05BCOIS7FH6QXpa1iBGAo+HGP2R/gVww3xLmE5ewwBFSU65fqhJd2nZgzNHsleQDtefyZNR9HR0A== 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=05Vlkq3Xmq9GA1USXavexmhprJXWFzls7cqapKWzTvM=; b=pUGOMHTLhGi6nhg6XeCPeDGxi4sq9Gt77+E1MjZGS6vdGeHSRvEKmL+WbwPVFOh4Ro3/jMqx/3wsuoeSVauIth93+Ln4sGJIT4Su/8ST0ZavkfI+GEEUdwpFAr9YYdvAGyXdfFlab89mR/c1Oc+kCLDBXWoze5C5ZNoJahGH+E0= Received: from SJ0PR10MB5613.namprd10.prod.outlook.com (2603:10b6:a03:3d0::5) by PH0PR10MB4725.namprd10.prod.outlook.com (2603:10b6:510:3e::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.27; Tue, 15 Oct 2024 17:56:22 +0000 Received: from SJ0PR10MB5613.namprd10.prod.outlook.com ([fe80::4239:cf6f:9caa:940e]) by SJ0PR10MB5613.namprd10.prod.outlook.com ([fe80::4239:cf6f:9caa:940e%5]) with mapi id 15.20.8048.020; Tue, 15 Oct 2024 17:56:22 +0000 From: Lorenzo Stoakes To: Andrew Morton Cc: Linus Torvalds , Jann Horn , Liam Howlett , Vlastimil Babka , Jan Kara , Alexander Viro , Christian Brauner , linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH hotfix 6.12 2/2] fork: only invoke khugepaged, ksm hooks if no error Date: Tue, 15 Oct 2024 18:56:06 +0100 Message-ID: X-Mailer: git-send-email 2.46.2 In-Reply-To: References: X-ClientProxiedBy: LO4P123CA0263.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:194::16) To SJ0PR10MB5613.namprd10.prod.outlook.com (2603:10b6:a03:3d0::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR10MB5613:EE_|PH0PR10MB4725:EE_ X-MS-Office365-Filtering-Correlation-Id: 6dd1990e-93a9-480c-dbac-08dced42adea X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|7416014|366016|1800799024; X-Microsoft-Antispam-Message-Info: 74hlVoDjMTkUZvvELCNFxuntYqq8CJJSaXRRmuTazWAqJjlgPt+RKuPKLYZ8JfElPFVF6SGegXubFyuGT2AmGtFKd8Msnz/dX4nJCTOq8i7tHguQp45Lq53M0Xx1Gmsxn7REJQIi0AdjRBW4Xzw8DwGJ4BI+uLB4DjVWTTNBDwygGAxp6zEqsmYRCwnsYv0dIsSQVBUCE+MfflofnJNcIJAbFnqNgQST/U4YQPuAWupwCcfB8q12KJA9NGjWfJw6WXCuEZLwO5xGn+tIlSxOimSVCld7jgfTFPTvKDgEpdY9mMxp0k0+E9/lCXd8rIruTPnrkdlfQ4A3Dy6iXp8brNN8hKQ03SwVMXKKuoQwkFybQTeVQKH9UU3uVTk6Sxcgtt783FtC/ik265yMZZ3kfWJnl5wpbh1CZBduVemnYhd6heYU+UENInkWm05CoQhVLFGN2CNimjIXpLbCyYl2M6fhZK3LtHtuMc5P7D36QjJthoPiQ7kcv1qTEztxd9HaFYFJbrwtWzzUXT71owGqmhjwkb+btqdvD+p7owZ5xJeskIWBb4J/Cb2+Wa8g03g10ejzgMoshz+D9EzYBn3VXoGZtvXNo4Q/3GnML2bsR3PdcRKqq6MuYbvl2FbNYf6sZX7O4HYhaf9tftmVETVx3GDJm/0N0WPeg93IBbWkjleLtD5HGRyt5EoSQn7Htv/VWjKZI/BU+d1ICbOK055a4oEBaRnwXvrpgZAe3PDGkTRHrEYEQbww6ezq4R3L3zwcQOvJ1xDYJLh/V9/M0sX386U18qJS/mGvqw2NiQBwohui3GEj4/szRRGRtGqmwRPHU3RZ5pDAxlq7rjITbjeNCe4cKlvfqJR1Ui7JzPu8yKNFPtLUIibjqT9Kqc/N0LmwzPBd1v08mUdR0frfkAAEe0H2+q5kJ005NMKHJi5fl+gYiqZbdit5Qc9nm8YH2c64XYZgv2C9GQsH6ZmbdqvfPqjC0QTWcMiPrFT5+qEKjuQp9I1pOQJWngyrhEMzt+s6jpBBYi/I6WUozOBxI2bYw0VTbCX6kwcw99t6ZDoi6AhrnPqoo+AspmsluDq5nydX+AsKdMxzLAqi2vNJlgZV92zpC7byBURrF3ovV3PIuKaS/dYXTqkRAVjr4O7AgoTk1vbG59Z342XWaFeI6h1zWv7w7A+0+3J/fAKEVceFmKG0bASwY0KXf42/uPC4TNPm5WXaicK/SnDGzGVCGiK3/Xqu7UQ+Lc1rkOQychd+VlXrXfZDPBN/BMU04n4uuY2L7u7MJ7WAZtQaqoRH3dJktQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SJ0PR10MB5613.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(7416014)(366016)(1800799024);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ubi33RJAMRLysJ1CZM6QrP08VyggS1Q3iAJaVDiUkujDuNjhE63gsspjNsMKulmt0KTcMCuBCDV3aaMHUvWVyCeA5Q4MVkleDgC0H+AhqqRaRYBeC2Q9qCeQWBGhfkFLDtOwOIqRQbDMeq8hLe9NUh/vZAd/SM+LzPaZpwa2wdVrcgHijRM/7gP0PNTZqMwDvJeRS8PBkuhdsbH77MeTor8/b7eFuF41aP9OwDMXFoZ3YgMwznIUpyUucCkJlViHHdqE4c657mrxioaGohOR+/wkkEqLH2Gq83mx0UlR7MOylzhSkvv2Dmk0BwciPQoGZEImiJnwMJs2mRE1eMJyUy7aV0wgfrnSCC3YOJApwAjk9Ea8NB/YdHWgoGwOjb1NxWXZfgDHt+DwhWyamZxZCoyB2XRnitnXyqBbaanYBpSbwLNQp8atsu6J2LfLK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UEAexM4/aaVzy+JgwztEZ3ExsQ1fdHIDoVGcdU2YcvE4gfe0iGEeeYAyXQm3Ho/B2bw3w8Wn4rOCWhQulnAdCutUJz/SINqGr8DLcqd9zvw== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: IL9ZwwZ6hrUyt0AEHQ2EaADYzeH9IdjWg+HuvKoFryZcU0WytaVOWZBlJzL+U5ZE7zLWWf3qcvxGT4mt7GTuF0Q+Sh0HWtAU1E4dKmjDxMuWlyNmlAubkC6RIhCm7le6jot1YJO+IaEIANuZDq+o3DYCjlVR0jaMRshhM9fyjN1Z83uGkgOLnz5SKAcMKe7j4hRFymufweEBBc3ib4psno00faSmzrKtOa3Hm/TOco+wmZ0EvsiuzvxGwxEjHwXAGrPSzM19HoBnoX9jioOVW1oMjHgMWa/ZmnxaiP1wmYO+c9Pm07TtBLtJY2l914Kxt84f2AutUwoXKidTzDLpfcYolPDDQ1tzOXUiAw6C0VvplTj7gL+q5POS8IuFfDeEWWW2QWbzEs4NfpXXoHKwv3iRFRstjPdkbpsTcirWuO98mkzy0XQLvPqSZFdoOfv8y1oUmHiIbiBUuQlQ3F/0DEpxpKzrMZijt6EaaWdOPAvxJBPoiH+n5vdV/5UPICKmOqtLYNqUP7l09MUuoSaJ00Ig5FalP1iKVqVMRQylcXMmMUqt2JXrjVVUXkPaunAHXQOMbVbOpEz8ER+/ihTL/bMJHqCnkGuI5DUKGCVPI7U= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6dd1990e-93a9-480c-dbac-08dced42adea X-MS-Exchange-CrossTenant-AuthSource: SJ0PR10MB5613.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Oct 2024 17:56:22.1868 (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: d0TUINwOuHF0I0hViDqI0p4NRynnwAKeGm5XlzQe3PWpU0j1w5IGT4X3NbyNfqbM5mFApQ7nG+npNDgeQxf9jtjL2ohX3urBRPuyNTjlSpo= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR10MB4725 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1051,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-10-15_13,2024-10-15_01,2024-09-30_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 malwarescore=0 adultscore=0 bulkscore=0 spamscore=0 mlxlogscore=999 phishscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2409260000 definitions=main-2410150122 X-Proofpoint-ORIG-GUID: vthpnDlnal1iTCXoT8Mmzt3v0eUEehph X-Proofpoint-GUID: vthpnDlnal1iTCXoT8Mmzt3v0eUEehph X-Rspam-User: X-Rspamd-Queue-Id: 8EF35C0010 X-Rspamd-Server: rspam01 X-Stat-Signature: o5t8jcm9rixj9p5jo5zwzzm1gusty98z X-HE-Tag: 1729014983-125472 X-HE-Meta: U2FsdGVkX18h1/xdCrr8Rv7bnHItK++zxhzHu9nq01FI4S0u7tLJp9kEXJI0pJx19PUgjLGG8AvewvvkPMLu47/rZHlJdhPFt/G0Yzh4slyIFkgR1KgIaPNBQzG0GGYyRYRJjDaBmLqkgFiqUCij4Sso4WJv2zlvp+yJzWokvEgSrUPMDzaDIthfUXngfw7WcqcxojTUzX45ticsg4c2vkztzbfN9X6NlSwpy+gM49n6PrJhfBSmljEN6wmBU8D11IqBVXX7OqFDxTVPF9JVcGk60dN8OY98S1UjWsP1ljWt0y6z+v0PIJZnDmyK9zbGzi/KBEPCntE1u0qI1ILfPjqfsS+iNN+mJKmvJsi1+sSlsTXFKOmkt6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kvfnQiwXOWtMXSD5UZvPH1yPa3scG0QaltqTYrmJfQ6E8Qt9nd0I2dGYOrIybpNha3wZoZXkEgk3cby1yTDXwXElYXRO/Bd/2Q== 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: List-Subscribe: List-Unsubscribe: There is no reason to invoke these hooks early against an mm that is in an incomplete state. The change in commit d24062914837 ("fork: use __mt_dup() to duplicate maple tree in dup_mmap()") makes this more pertinent as we may be in a state where entries in the maple tree are not yet consistent. Their placement early in dup_mmap() only appears to have been meaningful for early error checking, and since functionally it'd require a very small allocation to fail (in practice 'too small to fail') that'd only occur in the most dire circumstances, meaning the fork would fail or be OOM'd in any case. Since both khugepaged and KSM tracking are there to provide optimisations to memory performance rather than critical functionality, it doesn't really matter all that much if, under such dire memory pressure, we fail to register an mm with these. As a result, we follow the example of commit d2081b2bf819 ("mm: khugepaged: make khugepaged_enter() void function") and make ksm_fork() a void function also. We only expose the mm to these functions once we are done with them and only if no error occurred in the fork operation. Reported-by: Jann Horn Fixes: d24062914837 ("fork: use __mt_dup() to duplicate maple tree in dup_mmap()") Cc: stable@vger.kernel.org Reviewed-by: Liam R. Howlett Reviewed-by: Vlastimil Babka Reviewed-by: Jann Horn Signed-off-by: Lorenzo Stoakes --- include/linux/ksm.h | 10 ++++------ kernel/fork.c | 7 ++----- 2 files changed, 6 insertions(+), 11 deletions(-) -- 2.46.2 diff --git a/include/linux/ksm.h b/include/linux/ksm.h index 11690dacd986..ec9c05044d4f 100644 --- a/include/linux/ksm.h +++ b/include/linux/ksm.h @@ -54,12 +54,11 @@ static inline long mm_ksm_zero_pages(struct mm_struct *mm) return atomic_long_read(&mm->ksm_zero_pages); } -static inline int ksm_fork(struct mm_struct *mm, struct mm_struct *oldmm) +static inline void ksm_fork(struct mm_struct *mm, struct mm_struct *oldmm) { + /* Adding mm to ksm is best effort on fork. */ if (test_bit(MMF_VM_MERGEABLE, &oldmm->flags)) - return __ksm_enter(mm); - - return 0; + __ksm_enter(mm); } static inline int ksm_execve(struct mm_struct *mm) @@ -107,9 +106,8 @@ static inline int ksm_disable(struct mm_struct *mm) return 0; } -static inline int ksm_fork(struct mm_struct *mm, struct mm_struct *oldmm) +static inline void ksm_fork(struct mm_struct *mm, struct mm_struct *oldmm) { - return 0; } static inline int ksm_execve(struct mm_struct *mm) diff --git a/kernel/fork.c b/kernel/fork.c index 597b477dd491..3bf38d260cb3 100644 --- a/kernel/fork.c +++ b/kernel/fork.c @@ -653,11 +653,6 @@ static __latent_entropy int dup_mmap(struct mm_struct *mm, mm->exec_vm = oldmm->exec_vm; mm->stack_vm = oldmm->stack_vm; - retval = ksm_fork(mm, oldmm); - if (retval) - goto out; - khugepaged_fork(mm, oldmm); - /* Use __mt_dup() to efficiently build an identical maple tree. */ retval = __mt_dup(&oldmm->mm_mt, &mm->mm_mt, GFP_KERNEL); if (unlikely(retval)) @@ -760,6 +755,8 @@ static __latent_entropy int dup_mmap(struct mm_struct *mm, vma_iter_free(&vmi); if (!retval) { mt_set_in_rcu(vmi.mas.tree); + ksm_fork(mm, oldmm); + khugepaged_fork(mm, oldmm); } else if (mpnt) { /* * The entire maple tree has already been duplicated. If the