From patchwork Tue Sep 3 14:25:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Sistare X-Patchwork-Id: 13788798 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 31D98CD3439 for ; Tue, 3 Sep 2024 14:25:38 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B43E48D0187; Tue, 3 Sep 2024 10:25:37 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id AF3598D0151; Tue, 3 Sep 2024 10:25:37 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9C6698D0187; Tue, 3 Sep 2024 10:25:37 -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 789588D0151 for ; Tue, 3 Sep 2024 10:25:37 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 312E81204CE for ; Tue, 3 Sep 2024 14:25:37 +0000 (UTC) X-FDA: 82523650314.08.8F14D1E Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by imf09.hostedemail.com (Postfix) with ESMTP id 2F6DE14001A for ; Tue, 3 Sep 2024 14:25:34 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=RvIQcXEt; dmarc=pass (policy=reject) header.from=oracle.com; spf=pass (imf09.hostedemail.com: domain of steven.sistare@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=steven.sistare@oracle.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1725373429; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references:dkim-signature; bh=SCmpUe2PNIwntmkaaCzYuA70HnjmvxLglvLFlp0EGyA=; b=Ic+NrHd7Gjv2YdwC8GomTf0iJ9VOS6GNk22fvfnbq6+sSQJSg9cc9IsTYL9vL1pcuAfbuQ DyXgN8Ay7yx8D060ooTkfVd7lvsU5m0QFzpNHnZGeSAbHze4gORZuPTbBgibaFcB6TOsNw NitLjcxMUolMg+v7Cw+BgSNNTC8PlHY= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1725373429; a=rsa-sha256; cv=none; b=cAi+V/zGuCqKtQmz6wCiybzY+t0IzYrc07xwVVB0q0cZfsfO50HSS/T2qDzkr5nVB7FcKx T/WinzlacoWtdoiyExRn3733ox97KXJ8EKuSjs7DPZT9iVXk20KmNHs7WtdDijbPHdM13i nCYSCyABf6rr+4u5zYSC+8zEaMU75OI= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=RvIQcXEt; dmarc=pass (policy=reject) header.from=oracle.com; spf=pass (imf09.hostedemail.com: domain of steven.sistare@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=steven.sistare@oracle.com Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4837fVTJ009004; Tue, 3 Sep 2024 14:25:25 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h= from:to:cc:subject:date:message-id; s=corp-2023-11-20; bh=SCmpUe 2PNIwntmkaaCzYuA70HnjmvxLglvLFlp0EGyA=; b=RvIQcXEtt+iZbXRJIaiZeu et8bZpIBxuTSXSdhnBMifWTcFO/7nd3rLC4Nyy30D+8H/LJpxAG5AGf942/k99uX Xj5S0ubvQkrR6ZerGuvITdL725sNTl7rFe24T62PbwmngR0GWQr9w9WqhKQDMOfz uBe9GIjqBl4gCULxNTuggTY+DdWXyt2sL93cmzXjKwCfe8dl7kgVDVFdIq4sUX8C 2ulhLxNHZFpQoJZ6e8cEhRN/gK9IaNFC11EjBuKoUwg0239NYGjuz8VdOIROuRI1 AkpZRtbKO9T8GI/H/+24KLGUhg/JDlMdL8TCDUhqF/S1KUiEoTOb99rhNaFJOT8A == Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 41duw7s2by-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 03 Sep 2024 14:25:25 +0000 (GMT) Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 483E38No001869; Tue, 3 Sep 2024 14:25:24 GMT Received: from pps.reinject (localhost [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 41bsmf1mbt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 03 Sep 2024 14:25:24 +0000 Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 483EPN4I023489; Tue, 3 Sep 2024 14:25:23 GMT Received: from ca-dev63.us.oracle.com (ca-dev63.us.oracle.com [10.211.8.221]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTP id 41bsmf1maj-1; Tue, 03 Sep 2024 14:25:23 +0000 From: Steve Sistare To: linux-mm@kvack.org Cc: Vivek Kasireddy , Muchun Song , Andrew Morton , Matthew Wilcox , Peter Xu , David Hildenbrand , Jason Gunthorpe , Steve Sistare Subject: [PATCH V1 0/5] memfd-pin huge page fixes Date: Tue, 3 Sep 2024 07:25:16 -0700 Message-Id: <1725373521-451395-1-git-send-email-steven.sistare@oracle.com> X-Mailer: git-send-email 1.8.3.1 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-03_02,2024-09-03_01,2024-09-02_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 mlxscore=0 mlxlogscore=999 suspectscore=0 phishscore=0 bulkscore=0 adultscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2407110000 definitions=main-2409030117 X-Proofpoint-GUID: RWqTma5lbH4jjvs2Skj4YSCxM0kE6RuI X-Proofpoint-ORIG-GUID: RWqTma5lbH4jjvs2Skj4YSCxM0kE6RuI X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 2F6DE14001A X-Stat-Signature: cekebk98b3ee1ebrhnkan4qpss9wrp35 X-Rspam-User: X-HE-Tag: 1725373534-322158 X-HE-Meta: U2FsdGVkX1/22L1Vg7aJieeoje3BYpslyeWNSa5szffPlUC0gXrIo5gF/t44tNMKzUzJuVVKZwRHR9UaE+/vaLOAA5WmG670pQTbu1jFZuofIc8t7OZGwS4KOacPbd4Uzma2CvaMexSY0qJ/EsCIdbfh1YtsIE0mvuqLKeHvS9BpJabUi1lo1rAbu8/W+2IaKjubXR8BF4NtQqeEyOF1W1Prva/2fEUdN4DRgKnv/jOOqGQC4YuVI59iAMafobK/++S0K94MCTHHozO8C1zjBEYrTCsfbD2Lv3bzNp3qMsM+LLJPOU4VoUV5hCHvuOZuZIgf1lC/H2ETkzVrdewx45Oju0MBOHerPtWsRDMdcN7rnQV65od1cW6T6RgSRk0AEhQkZ3EpH7aH2HAoh0LJs/ZuIzTlJEwfXaIWR3Q0gr+nBw5ORiNhVEl0yLh+zalMnWZpApjE33X4dA8WaL+FTUrMT8uH1hqcaQ/+sffv6bWXbvtD95nqzjjhqpb/ZHc5xz/c/DkJOwvk7m6Ewe+d3VnnYnAGoUGVgHpab9lIznJIUCdUc8ncM+NBtWGxTkM/uD6xlUkqv9/MOwyyhSGoY32fwmUR/tgxS1G1tzhiv1FTSmiqlQdEZUHNA8iAn2p+DlZGipArbaU/sGwzI+EtYI9PfIK7hnN90Pz/fuf/CGp1QboVRR6Iu4F5HgTqDRB/4VMEw8ynbPwNU3hmz5fR86fOXqDFzK689vv1kTsGUVB0NKw1AARKNWO9sx00tcdN5u8+aQD0SP0xnfUO6x/BOL2SaD476ryWESdScGRZHAdQGNwh3VWedCVFeIqeikJ7KTR1EkntAi/TjIZJmIndnSnTyp5TY+jzPFUDfa+ih2+unVndM2AHJMSLzmYO5VDx5thlwOr2x6CwrXBDvh/iG0r66s56sPhTVVD7fz26pWJHYKplOlyyPGKERhpRtfH7WJyudu7nUe8oaEMr0Ky CvSkfUPl Wfi3lUOZft6GT/YT4ABu1e1nnH8qnYKgu+3otlKZi96+5jfrr+NtVq5bc73if2JX/BP1lTGQNGtbqfy88eVZl9vHvi03pqfITEwvEw3ozviWT0IR47ehLIHofLWYk5nLcCjpc9+rPLcQNwWvfddDtTNuohCXhvT1oWbMJWr+GCmJ4FWUZJNY32aVdPQ== 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: Fix multiple bugs that occur when using memfd_pin_folios with hugetlb pages and THP. The hugetlb bugs only bite when the page is not yet faulted in when memfd_pin_folios is called. The THP bug bites when the starting offset passed to memfd_pin_folios is not huge page aligned. See the commit messages for details. Steve Sistare (5): mm/filemap: fix filemap_get_folios_contig THP panic mm/hugetlb: fix memfd_pin_folios free_huge_pages leak mm/hugetlb: fix memfd_pin_folios resv_huge_pages leak mm/gup: fix memfd_pin_folios hugetlb page allocation mm/gup: fix memfd_pin_folios alloc race panic include/linux/hugetlb.h | 10 ++++++++++ mm/filemap.c | 4 ++++ mm/gup.c | 5 ++++- mm/hugetlb.c | 17 +++++++++++++++++ mm/memfd.c | 15 +++++++++------ 5 files changed, 44 insertions(+), 7 deletions(-)