From patchwork Tue May 25 23:31:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Kravetz X-Patchwork-Id: 12280357 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A7EDBC4707F for ; Tue, 25 May 2021 23:31:51 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 13EA2613E6 for ; Tue, 25 May 2021 23:31:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 13EA2613E6 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oracle.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 3FD236B006C; Tue, 25 May 2021 19:31:50 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3AD556B006E; Tue, 25 May 2021 19:31:50 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1DB946B0070; Tue, 25 May 2021 19:31:50 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0008.hostedemail.com [216.40.44.8]) by kanga.kvack.org (Postfix) with ESMTP id DB7436B006C for ; Tue, 25 May 2021 19:31:49 -0400 (EDT) Received: from smtpin22.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 7F4C3A749 for ; Tue, 25 May 2021 23:31:49 +0000 (UTC) X-FDA: 78181353138.22.F84EDCB Received: from aserp2130.oracle.com (aserp2130.oracle.com [141.146.126.79]) by imf16.hostedemail.com (Postfix) with ESMTP id 11A758019105 for ; Tue, 25 May 2021 23:31:42 +0000 (UTC) Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 14PNOguC084767; Tue, 25 May 2021 23:31:46 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2020-01-29; bh=9YhdL/k2pa6x8WHpZUlXfQ+hZShDsdX9onfMwZ34WFw=; b=axBQZJfib9AcHx4ZnHa9RuaSJvjEoUMfCymM0Tcn8/e0UBjiJDtuDZYTf6JVFl2UH0ye 7naAot3vpsBxj6NKxy5bJUPkOyX9+94fg8WTrDicn2wzMzwntPuO0r0ReHYt1QUo/ph7 o3jlhfr3gUcrEe7i5XMwY1MtvEs+AUhIij2onsLWHPGoDEEeOAnjhfYh/qNqbZZukRrw 9yj/yuJ0XsioCjNNTYJf8A5XYr9BA4KCq3uPQLUIBCreIWNX6LWpI9XFjcHZPhUzxR9v q1pLdSwihDBUg4alK51izlpTSxbmLBum7rtwIsPW9hWPKGDZrYK4lF1YHVbLncohbakC ug== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by aserp2130.oracle.com with ESMTP id 38pqfcfhrv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 25 May 2021 23:31:46 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 14PNQ58l086196; Tue, 25 May 2021 23:31:46 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2102.outbound.protection.outlook.com [104.47.70.102]) by aserp3030.oracle.com with ESMTP id 38pr0c7d22-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 25 May 2021 23:31:46 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZVFyu9DRXK85NijGg41BAimwWG+9s0ek5vRyJbCSc40iWtuc/3Hrlte1Q1UaBy0R/9uBUVkQdZRLdibu8mHZpA5ZYJWi8OMQqHWpj3N04UWFiOWfUqFsZDQpl0VN0MlWIYxGOXN/d+rMUn2OeweaPely4PYZNfoQfLrF8wzaMOav/3/7Y2vxb7Vs6lBJR1dNLVU56NhyBueOMZeXksKILLwCZqNRqWJUMNxg68Gf6dH0sWYz8QEAya0TYUx1sMH8eNffN5CN3z/bXeO9s06qNPDlzphae1IXO2QdyMC3fYljtt72+Hy2NNLrmWiJ5kzHV3P3bakUzKM3VbJNGlDp2g== 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-SenderADCheck; bh=9YhdL/k2pa6x8WHpZUlXfQ+hZShDsdX9onfMwZ34WFw=; b=SE65pN5E9wgabHkJILt+HtLKfaA+w/cuY7D3O8NiDw6Ya+XtUROU+/Z2BzcQVDbE0FWdUN/KEA4ncMZX/4xIYzUUGz/tDq2AYksp8FRofOiudEPbVzHy+g/sqEdYdHxwDVUDL0O5SVAWJRSEV9x/oXHn/UaM/7PNzvHqcbfFAGS54pHgQ0z8VoUlP1ssm6NdkroKuKCRQrq9PC1zHcz95N2bxTyzMPjCYxR7HnqO5d4yJ79NRKDvw6Gn4bCjostwg2WrM58+oBROs1dFsfZDbuNYFq7xFvN5w/zzR+8+oJkNagcGyfd7Igm7cFqujAQIAx76WUO+uEBlkvxZiXhVwA== 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=9YhdL/k2pa6x8WHpZUlXfQ+hZShDsdX9onfMwZ34WFw=; b=aXenvG34OrW/hiAZI1eX6KKWPTYVrsV7xYSgn+RPeWNWiqa7UlV4MMMVW46BnO585b+NN5JTlWksV1PfYpzKK7FdwGWKc57q3RgO3TQpstuzvqeZCTzqD4G6JVkgrJDd2RcaxrvOEdCsrH8/SbFcmhHoMzDpWtdFCsq46dFsMpo= Received: from BY5PR10MB4196.namprd10.prod.outlook.com (2603:10b6:a03:20d::23) by BYAPR10MB2664.namprd10.prod.outlook.com (2603:10b6:a02:b7::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4129.26; Tue, 25 May 2021 23:31:44 +0000 Received: from BY5PR10MB4196.namprd10.prod.outlook.com ([fe80::4407:2ff6:c0a:5d90]) by BY5PR10MB4196.namprd10.prod.outlook.com ([fe80::4407:2ff6:c0a:5d90%9]) with mapi id 15.20.4150.027; Tue, 25 May 2021 23:31:44 +0000 From: Mike Kravetz To: Mina Almasry , Linux-MM , open list Cc: Axel Rasmussen , Peter Xu , Andrew Morton , Mike Kravetz Subject: [PATCH 0/2] Track reserve map changes to restore on error Date: Tue, 25 May 2021 16:31:32 -0700 Message-Id: <20210525233134.246444-1-mike.kravetz@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <78359cf0-6e28-2aaa-d17e-6519b117b3db@oracle.com> References: <78359cf0-6e28-2aaa-d17e-6519b117b3db@oracle.com> X-Originating-IP: [50.38.35.18] X-ClientProxiedBy: MWHPR13CA0021.namprd13.prod.outlook.com (2603:10b6:300:16::31) To BY5PR10MB4196.namprd10.prod.outlook.com (2603:10b6:a03:20d::23) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from monkey.oracle.com (50.38.35.18) by MWHPR13CA0021.namprd13.prod.outlook.com (2603:10b6:300:16::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4173.12 via Frontend Transport; Tue, 25 May 2021 23:31:43 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c878083b-69e4-4de8-3635-08d91fd54192 X-MS-TrafficTypeDiagnostic: BYAPR10MB2664: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5797; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: toIJMw7uBtKPZH8XSUAP/rHq90wX2Ppvl59MmXuat04ta0uzP890nfVnkkIACX1xeubhf6ZYqBwTEYJa+ja5nXj9mfv8oyFbjqD6BDr7xa4bLtyqyB39iOMUbcHUicOpON2T6hqSXH2yDJJjLcFTavlV0N5zcYvkCmAPiDc0fTIvA3yz1nbg21Xxx+gS4d8UOh9ymarDk3AL1543RnnM2RNmW5hKu0dVnO4v1OVvkVP/Cf1IDaBFG2HIMq7wl1MDA26Aq0VXLrdNZvFFH9jogmELyyLuR9VEIMMy/rZCEboV84LZpEwTfZhRvDyJcG1Tt20pMYYRCxRYdUcLA3Fb/LO9C+qx+kOt+g/nbAcadcItXa5Mdieztg5dISjmeYt4MkK8s1yUiKV/+LDn4FfAla1zKS7wfqn8hNPeQKN983PlXDMGgxC8pNYiq7qZyycJNbRC22a7pY+M2q7RgDADk6hsNooYlZjuoRuZo9t6FDQL/qd7cZer3zW6zOweKoJZWllKlkNJrYUKmN71KDRKgtfr1vbUuHZd6SX1wraQVyN2Aj9Hc3bkJCRGqBix0t1wrTNkzN8ofjdTJzej2nZiM7xj9VRCjxmIyTRVNpwEzyVm7edBGUccVM7z9SACY2M1E9buNj/up1W5JxxywuSozA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BY5PR10MB4196.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(366004)(136003)(346002)(376002)(39860400002)(396003)(26005)(8936002)(6486002)(6666004)(956004)(16526019)(5660300002)(107886003)(66946007)(66556008)(1076003)(7696005)(52116002)(186003)(4744005)(44832011)(4326008)(2616005)(66476007)(316002)(478600001)(36756003)(2906002)(86362001)(38350700002)(8676002)(110136005)(54906003)(83380400001)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: W2Q23CSLNBQ7DTSupDSljZ/PytaSUOVZyhH1CZU8ioKqTJTDQnzgroeyYVxRqqrQudrMIbQefvgrynr5IobtVWVqOH4W2+WFiSHl7BDs++nPhZDSDeQ9UIy9edlCBHmPsukfCftTwSYo/rVgEytQYHx+v5rQNgh8m+6xIbmhZVSShok9LkQQqZnfKpoVinVrS+d2SRtm9vreuVsx+ty2D2cmguKOb7eJCvcI2aCl8Ak0Tu536bq47/ZJQYODKs3OKa1Jr2jjPE1qqH2M1zHX5X8Uh2MwBPWuRt52PlTlKVjNxnSA+YdfhxQxxV4MxNmBEnGJ4OWuAyNK7eS/Ma7+tsPT8LzfIaVJuNKHDcIx8gHfAYcEOIBhavPMznmiMZBZ98KF93zrrTQ8+c5CVqEULYbLtJCRYLAcds3GGBK+xvdIjatBFJ1ZZ0IUR7iyGv4GRSVPMjdpdhGxCZJyo+dYtgKc5/FyJHM1P5qBUyfo0CuABJCKekT+CY2gody0dbVuJZkKlo6LhLuQr13kKM3xBEvOSZDKW4nIhXiUwGc8qMKSfLazrXvAVgscfw6nvsc4l/akSuDIK07qQ9p0AgYB3JW13G8hG/TWAH8zJNoOQKo3WGq0uMGllHMcBQHNkLYFul9d3YooMhHb36/gleamUFVn8plT8pzYam8xwEn9SyYJu88XjgDJ9af4a05DGyZeh3gWRGIs9q5JIfzauyeYL7VBqJPZEPpKSRRsOrSCqaQ81bQLu1rC4HkHsaW2/zQi+T4da/zMDN2GptqvmtwCB4Uddha/XhdaEoywYkSlg9/VU/LZUjKYWf7vvp09v7hM7024HNK0IfTMBq3vDvX1095wtzBDmsn4w4kJA23FVl3sChtHdQ7s41sHydPfgVcUuJhHma//9xhALV+6zQe3HrHgjxPbuwJUgsLwqvWzpWcpaZjdQLMisAwnaGtA0DR/GNwWqela+3v3FNE6n2dp69ZTT3/RPuI1knbRUwXs6xO9gboiXEi80yiNLK9hmtHP4kyN6Nl+FwiuRTCYamZgJEBwjP8isW+ZLJMPYq/+F64Ol78HiWK1i+31bwDeKsmAfRmq9GbPOjIuBVLU6AnRWA8yyMV73pGuK81g+exQCKAAUXKcMEJLFsjkaovp484welYVSE8GUFtM2z9+mSk0nk5RLdj0TbSa0CYdToIY3zIFP9rS1Sx0xzyjKy42jQpcZL31VO7w4uG3OtSoy1LICHk75fb+zkrv8ySPgEVJyHpzh1FBN2n3hHSUbnd5AmHHcJRnN8Jmz7p0w6u2HjlVCsfAl7IJA32AXJ80/ceXRuafz0c1X8Tmlo9Nn+2/EgMl X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: c878083b-69e4-4de8-3635-08d91fd54192 X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4196.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 May 2021 23:31:44.2304 (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: FghDGk8cPRuD1O2jqb42mC/WBvEhjw+08j2leP88Mni0JKDikN2ewXk2r9e2i+kcyOZiwkkfLZADsKC5aCKJsQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR10MB2664 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9995 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 bulkscore=0 spamscore=0 mlxlogscore=999 malwarescore=0 adultscore=0 phishscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2105250144 X-Proofpoint-ORIG-GUID: -3LmhE-vADd5TzG6ucuY_H1MLywHMwjp X-Proofpoint-GUID: -3LmhE-vADd5TzG6ucuY_H1MLywHMwjp X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9995 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 spamscore=0 mlxscore=0 malwarescore=0 mlxlogscore=999 lowpriorityscore=0 impostorscore=0 adultscore=0 phishscore=0 priorityscore=1501 clxscore=1015 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2105250144 Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2020-01-29 header.b=axBQZJfi; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=aXenvG34; spf=none (imf16.hostedemail.com: domain of mike.kravetz@oracle.com has no SPF policy when checking 141.146.126.79) smtp.mailfrom=mike.kravetz@oracle.com; dmarc=pass (policy=none) header.from=oracle.com X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 11A758019105 X-Stat-Signature: 65149r5tq6doxmzwwazxdogtn19yq566 X-HE-Tag: 1621985502-933893 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: Here is a modification to the reservation tracking for fixup on errors. It is a more general change, but should work for the hugetlb_mcopy_pte_atomic case as well. Perhaps use this as a prerequisite for your fix(es)? Pretty sure this will eliminate the need for the call to hugetlb_unreserve_pages. Mike Kravetz (2): hugetlb: rename HPageRestoreReserve flag to HPageRestoreRsvCnt hugetlb: add new hugetlb specific flag HPG_restore_rsv_map fs/hugetlbfs/inode.c | 3 +- include/linux/hugetlb.h | 17 +++++-- mm/hugetlb.c | 108 ++++++++++++++++++++++++++++------------ mm/userfaultfd.c | 14 +++--- 4 files changed, 99 insertions(+), 43 deletions(-)