Message ID | 20221216155219.2043714-1-peterx@redhat.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> 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 C1A7CC4332F for <linux-mm@archiver.kernel.org>; Fri, 16 Dec 2022 15:52:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6256A8E0005; Fri, 16 Dec 2022 10:52:28 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 5D5938E0002; Fri, 16 Dec 2022 10:52:28 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 476CC8E0005; Fri, 16 Dec 2022 10:52:28 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 35F188E0002 for <linux-mm@kvack.org>; Fri, 16 Dec 2022 10:52:28 -0500 (EST) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 117098111F for <linux-mm@kvack.org>; Fri, 16 Dec 2022 15:52:28 +0000 (UTC) X-FDA: 80248611576.27.9CA0C78 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf25.hostedemail.com (Postfix) with ESMTP id 2AF71A001E for <linux-mm@kvack.org>; Fri, 16 Dec 2022 15:52:26 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b="HDrueCX/"; spf=pass (imf25.hostedemail.com: domain of peterx@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=peterx@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1671205946; a=rsa-sha256; cv=none; b=A8D+1O4ArcmVhAfqbuuU6XVc9yI0Dr4X76/jlTt43YPogc/QUm1FjCRX8cq3F6rOtxBNjo q2iAL+zaS6Xw8s057llLd1NZomdWLg2pvW56vfPWasfqGzJyaMxkzo/pVmqRZ+ZrwDT7Ww t44AsBXIO/fP0G28JzqnsZtH9bzACA8= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b="HDrueCX/"; spf=pass (imf25.hostedemail.com: domain of peterx@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=peterx@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1671205946; 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=7a/XOpLMoccJVDSJCL0inQbFYq9WEos4O0UHGEG2GQ8=; b=wa+Io4pdJ38ZCg5UCJrz2op/NLED3ugoNMRwrJ0YoAuclEctsCNyTZee5I62reToozjoIq jQeRmWjHmlI/bxUR2e0Id1TcovRipodIbG8e7VVWh+EqtwedoE/CE6UJRowBUyyJyFAj8o X/4SmQD+XoL3RvSn5OH6p7FQ8AZOhE4= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1671205945; h=from:from: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; bh=7a/XOpLMoccJVDSJCL0inQbFYq9WEos4O0UHGEG2GQ8=; b=HDrueCX/cVDYX/Kg6bCPPhhJl1NWa4x2q498z1bjq6V/ab4HoWmNkHhH5sRz4ctYpOEbAH iWt1hCeJi9iGYd4W1hXrTsAr9TjYT5Lxp9od8m7+LrrqIRySRWW0mRV6NOciiw1t2w62bn OrXqT4DbmcFEJmkWd2pNf6Gkd5kgByM= Received: from mail-qt1-f200.google.com (mail-qt1-f200.google.com [209.85.160.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-104-htPPHwGgOGaFWjED0wNC_g-1; Fri, 16 Dec 2022 10:52:24 -0500 X-MC-Unique: htPPHwGgOGaFWjED0wNC_g-1 Received: by mail-qt1-f200.google.com with SMTP id fg11-20020a05622a580b00b003a7eaa5cb47so1772332qtb.15 for <linux-mm@kvack.org>; Fri, 16 Dec 2022 07:52:24 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7a/XOpLMoccJVDSJCL0inQbFYq9WEos4O0UHGEG2GQ8=; b=gNDysy7qpnr4dp2Sf+ofYXALPiPfPkCdk2D6QVZeqzW7w8J3Q6Nq3mbDcJglmbeU47 rp1XGu9XJS/FMao53tSnpdbwX7cc08Us4ode4ydrcflLGZ7p9l2xsNTkpERXUHLDUeyA Ts/xiEEA04IrvKtJa1VW4DdQJkhAz9cJQwtnlWyo4yy+uAxlo80n2Y5vuNujVDJ9WxLi CaPoT4daGfan5vYc9mBHJncOGkOkWdtDyaKBC+ZJ6zHqHHLAyoWr1+OjNNIQ8DU0+uCw FQZNy2oG+q1syNF4wCN/NlxNIGu4+7xuQE8Oo+5ig18/o1A3pNJ20y4K5ugwPc+wYZWF /nkQ== X-Gm-Message-State: ANoB5pk5hVgiNi+dxtv2ZikG5XhsIjwVc6nzqVjNWhcEQSh7VFQ62vtL 0ctpy6LgDZ0oLh2v7TQ3kFIz6D0gr8Ix4IiWqE1utpK7BT3pDzMhAPzVFcd/MTA6df9zgLZzsSl u6uzQCwtVY00= X-Received: by 2002:ac8:5755:0:b0:3a6:9162:245e with SMTP id 21-20020ac85755000000b003a69162245emr61455512qtx.36.1671205943494; Fri, 16 Dec 2022 07:52:23 -0800 (PST) X-Google-Smtp-Source: AA0mqf4eRO6j6nITJR7U5O1saoqGPaZuUJ+DbwInDy4iHwhtjCTw5HCWKMaEHXGZqHgIE74QZNrEYA== X-Received: by 2002:ac8:5755:0:b0:3a6:9162:245e with SMTP id 21-20020ac85755000000b003a69162245emr61455484qtx.36.1671205943290; Fri, 16 Dec 2022 07:52:23 -0800 (PST) Received: from x1n.redhat.com (bras-base-aurron9127w-grc-45-70-31-26-132.dsl.bell.ca. [70.31.26.132]) by smtp.gmail.com with ESMTPSA id d136-20020ae9ef8e000000b006fef157c8aesm1673001qkg.36.2022.12.16.07.52.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Dec 2022 07:52:22 -0800 (PST) From: Peter Xu <peterx@redhat.com> To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: David Hildenbrand <david@redhat.com>, John Hubbard <jhubbard@nvidia.com>, Muchun Song <songmuchun@bytedance.com>, Mike Kravetz <mike.kravetz@oracle.com>, Nadav Amit <nadav.amit@gmail.com>, Andrea Arcangeli <aarcange@redhat.com>, Rik van Riel <riel@surriel.com>, peterx@redhat.com, Miaohe Lin <linmiaohe@huawei.com>, Jann Horn <jannh@google.com>, James Houghton <jthoughton@google.com>, Andrew Morton <akpm@linux-foundation.org> Subject: [PATCH v4 6/9] mm/hugetlb: Make hugetlb_follow_page_mask() safe to pmd unshare Date: Fri, 16 Dec 2022 10:52:19 -0500 Message-Id: <20221216155219.2043714-1-peterx@redhat.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221216155100.2043537-1-peterx@redhat.com> References: <20221216155100.2043537-1-peterx@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-Rspam-User: X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 2AF71A001E X-Stat-Signature: wjc3icrk6fi73wf18jwybg64ggjxfawp X-HE-Tag: 1671205946-649475 X-HE-Meta: U2FsdGVkX18OzGf0XoIroG3JnS47xsJu3MIPg5CTspYqkMztkw8FraQpB8pAK2QqGirvoE9G4ky70/NC3rimgL/8DMn5xTnmJ1RfrR/PQNDH2W+/WtqUX+n3/N+KCxXMBzXW9/zKDcxN87pZ6TPZYjP2YvlGz7ZM+7cCuM2dWiNj5sVq6rMUfh24Fy3lz6hCegEyHpSnXU24ro3r4XXr7Xme4oEip3vfS/RDjIMY+iyl2+nu5z2UFyvQ3lwx+bnOwzGL9bQjR6X2giYgtqEUCgLLEdxxgEUzFbEzBTf2lqDyheRoboSPgzR1NduekjHcJoBxwraY2uZJRC89xb1c60e0p/+MuSMOqigsHfZp7N3ksmjNGnCIYWRySW7XztDO/PWdzetEt0kqJEQLUFA87RlWzHckBQf3iaSOiqhaPuJRjACT6qVuSF8GVzCiJ7t26A867LX4LcOJmdTW8XBv4sIEaXADmo/kA0bdq76NXIggtR2pRK5wZnaUvGHgS0xPVaiO5r4UCb2djbs/dauThriXF25UiLxxWYYaEdhpruln6H8bBpvzrtTUoCgVMffV7K4ztNwgEwQDOz04z01QVKLplsUdXhhqmYZ2yHbdm3688x2NnIkfezkRj2Kd+MRKDOJV9Hp2ssn5wmMwH8hW5xaVXcE8Kw4xl3j/IO4KAJdwbGJkNKpDNnWsfrLjE7/c3iBmC/v7TsCdOB5MwrPRa5Xmq8wtE1Umyxz3nSEFQ7DvHX0j8HPnxBXZ/Ls7ySSpG387faikw1bzalZ3CcdlImOcrJdAg1dt1LeQBENGdweyo2WtMfEly3UIOpVJ/xQg7YdG2uo/Qk60/ke1jliRAtq+6CwkKxy/KbPL+JuaRxvaVsZhTxdVlu86a/8tkhdHfJcHpPeqTyoHuYCIDMAmGj1Dj8PcP+h0LMev3bMLHsI3nSjTzMxnUs5FCiP2OoX+4mICf3moigFsAr7p2PY 1oL+M4kH yETYYSTtM/UMWBbeK3x9xXj8rIYVH3Vgu5meeEaAgmvQlrSPcAmIXtCqstn/LK1BE1Q8uO7T05oRXmMiJ3UsO/yMNZxUi7wBNW6skfg2e7BLeUXfxFVqtHA8tLMPzuHLdzComD5ZavW8bBgjp5o6KLB7xnZANEHCUZK2FMpmlfenhI9mBn3xnnUPnbKBib6P7t+mRBFDFeC03KSm89jZoxWWyCeDTNz/sc7yR 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: <linux-mm.kvack.org> |
Series |
[v4,1/9] mm/hugetlb: Let vma_offset_start() to return start
|
expand
|
diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 64512a151567..0bf0abea388d 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -6375,9 +6375,10 @@ struct page *hugetlb_follow_page_mask(struct vm_area_struct *vma, if (WARN_ON_ONCE(flags & FOLL_PIN)) return NULL; + hugetlb_vma_lock_read(vma); pte = huge_pte_offset(mm, haddr, huge_page_size(h)); if (!pte) - return NULL; + goto out_unlock; ptl = huge_pte_lock(h, mm, pte); entry = huge_ptep_get(pte); @@ -6400,6 +6401,8 @@ struct page *hugetlb_follow_page_mask(struct vm_area_struct *vma, } out: spin_unlock(ptl); +out_unlock: + hugetlb_vma_unlock_read(vma); return page; }