Message ID | 20221003155630.469263-3-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 0391BC433F5 for <linux-mm@archiver.kernel.org>; Mon, 3 Oct 2022 15:56:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6CDDD8E0002; Mon, 3 Oct 2022 11:56:39 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 654596B0074; Mon, 3 Oct 2022 11:56:39 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 40C828E0002; Mon, 3 Oct 2022 11:56:39 -0400 (EDT) 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 26B106B0073 for <linux-mm@kvack.org>; Mon, 3 Oct 2022 11:56:39 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id E1652C0BF9 for <linux-mm@kvack.org>; Mon, 3 Oct 2022 15:56:38 +0000 (UTC) X-FDA: 79980090876.29.B1BAE15 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 1CCEBA001D for <linux-mm@kvack.org>; Mon, 3 Oct 2022 15:56:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1664812597; 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=x4xYjXYzlE422UA6NYhxH1mMMh8xu1ZsHfGS6BWev5s=; b=ftxIuGaEAu6OG+TQ+sN37uhdOsQ7E0sp4z9WF5f/6S6qnVRVsgFVmKkSsvUnYbSMELrh6a XFYoYlokhHyFOpjQuUWTHt4OIxRKazGx9+oJpts5Vsh4ePYYLXPd1HZlV/lM8AXGhReEyc qPPHZkpG/rMb2RoilbKSgQlQNU6uQCg= 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-604-YtAU7hG-OL2bJcLZ_5SfKw-1; Mon, 03 Oct 2022 11:56:35 -0400 X-MC-Unique: YtAU7hG-OL2bJcLZ_5SfKw-1 Received: by mail-qt1-f200.google.com with SMTP id e22-20020ac84b56000000b0035bb64ad562so7549674qts.17 for <linux-mm@kvack.org>; Mon, 03 Oct 2022 08:56:35 -0700 (PDT) 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; bh=x4xYjXYzlE422UA6NYhxH1mMMh8xu1ZsHfGS6BWev5s=; b=EdI8KeRTwJDPf6Urz8j4dtCXhne3RqhE9zVYk45cxbdP0c+wk5uPZsPvZN838s/xRy gqpeYTisCiBLh+X//D10hiQ2jaWF2Npp2LyQei5WxwXxTR1r1sy+dxUdHHFsv/Nz3deC CbXF4FDGbG/bR5EE92zqtqCaR3OI593d4lK9+2Ga1BJC5mXNLK0+KD6CSHsQdoIQVjtf AyMv9AozTOYrnIYOOKksi0Enq8IUdMBtTJx3af4VXr9IjDvtwKgtQNw4lX7BoQ5yHNGK nL4tyrpXMjbQo9qVN+xBJ8EZ1aHc48aClCyalpJmh37+6zbR+dZgbzsQf/evzuK2H2M2 ld3A== X-Gm-Message-State: ACrzQf14NbY9J10TVUTF9/pAvx80Dua8Rzu+J+IA7vt/OKveJjhjOmtU wtt/bI/5F83ETlWfjRT99ZTXzIxtOiL6uYzHQbzyMOBFPBaWZFkhRqiaactzyKA0UlGSj5t/6CW QSjF3zFL7wuo= X-Received: by 2002:a05:622a:11c8:b0:35c:e912:a8ea with SMTP id n8-20020a05622a11c800b0035ce912a8eamr16371754qtk.17.1664812595448; Mon, 03 Oct 2022 08:56:35 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7jmUpIO0vv9JXx3e6EMgXhYeRsvGCHvJYDkuTWLTvnmvX6dtNKe0ySPp+Up7ucpY2Yh41crw== X-Received: by 2002:a05:622a:11c8:b0:35c:e912:a8ea with SMTP id n8-20020a05622a11c800b0035ce912a8eamr16371738qtk.17.1664812595208; Mon, 03 Oct 2022 08:56:35 -0700 (PDT) Received: from x1n.redhat.com (bras-base-aurron9127w-grc-46-70-31-27-79.dsl.bell.ca. [70.31.27.79]) by smtp.gmail.com with ESMTPSA id bs18-20020a05620a471200b006cf38fd659asm10956732qkb.103.2022.10.03.08.56.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Oct 2022 08:56:34 -0700 (PDT) From: Peter Xu <peterx@redhat.com> To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: peterx@redhat.com, Andrea Arcangeli <aarcange@redhat.com>, Mike Rapoport <rppt@linux.vnet.ibm.com>, David Hildenbrand <david@redhat.com>, Andrew Morton <akpm@linux-foundation.org>, Axel Rasmussen <axelrasmussen@google.com>, Mike Kravetz <mike.kravetz@oracle.com>, Nadav Amit <nadav.amit@gmail.com> Subject: [PATCH 2/3] mm/hugetlb: Use hugetlb_pte_stable in migration race check Date: Mon, 3 Oct 2022 11:56:29 -0400 Message-Id: <20221003155630.469263-3-peterx@redhat.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003155630.469263-1-peterx@redhat.com> References: <20221003155630.469263-1-peterx@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-type: text/plain Content-Transfer-Encoding: 8bit ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1664812598; 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=x4xYjXYzlE422UA6NYhxH1mMMh8xu1ZsHfGS6BWev5s=; b=bFCxhuoX+ahBymkPc9WNtXxiNDccF/jXiQfcwi4GMoYt9c6alcBKodi/9JEeAgyEKjtXX+ UpzEpTPZ/a9WXHtoaawjdsCPlwKjyct0qdi/iLevckkILPJgvvkPIZ/Ceh/l5f7HHaTYDu DDXq9UWpXR/g089ss3B9VuuEW6D9AVU= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=ftxIuGaE; 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=1664812598; a=rsa-sha256; cv=none; b=QSU+AsjLiYcuVMGED475515OvSnxIyTxVL2jApyBhRFVEDWNSwEEbV1pZ/xvik8WRLlaMg vmMJlEWBLaPkw4wf7e2yNgIOLqSm9vcLtpJcD/erywhGsjBZmUPGIZrTPbDjXv6qykMa5S Xk8QeYmefZelzF1kguvrcxc+W0xLIjI= Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=ftxIuGaE; 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 X-Rspamd-Server: rspam11 X-Rspamd-Queue-Id: 1CCEBA001D X-Rspam-User: X-Stat-Signature: dt1tmoayb9hsjfamd7kezdte6qwhz3pn X-HE-Tag: 1664812597-541439 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 |
mm/hugetlb: Fix selftest failures with write check
|
expand
|
diff --git a/mm/hugetlb.c b/mm/hugetlb.c index fa3fcdb0c4b8..e762c5369a6f 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -5620,11 +5620,10 @@ static vm_fault_t hugetlb_no_page(struct mm_struct *mm, * here. Before returning error, get ptl and make * sure there really is no pte entry. */ - ptl = huge_pte_lock(h, mm, ptep); - ret = 0; - if (huge_pte_none(huge_ptep_get(ptep))) + if (hugetlb_pte_stable(h, mm, ptep, old_pte)) ret = vmf_error(PTR_ERR(page)); - spin_unlock(ptl); + else + ret = 0; goto out; } clear_huge_page(page, address, pages_per_huge_page(h));
After hugetlb_pte_stable() introduced, we can also rewrite the migration race condition against page allocation to use the new helper too. Signed-off-by: Peter Xu <peterx@redhat.com> --- mm/hugetlb.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)