From patchwork Wed Jun 9 04:30:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hugh Dickins X-Patchwork-Id: 12308845 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=-23.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL 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 416ADC47095 for ; Wed, 9 Jun 2021 04:30:06 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 9F48861246 for ; Wed, 9 Jun 2021 04:30:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9F48861246 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 2EFD46B0036; Wed, 9 Jun 2021 00:30:05 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 29FC66B006E; Wed, 9 Jun 2021 00:30:05 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0F3056B0070; Wed, 9 Jun 2021 00:30:05 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0078.hostedemail.com [216.40.44.78]) by kanga.kvack.org (Postfix) with ESMTP id CE6FF6B0036 for ; Wed, 9 Jun 2021 00:30:04 -0400 (EDT) Received: from smtpin18.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 57A9C181AEF2A for ; Wed, 9 Jun 2021 04:30:04 +0000 (UTC) X-FDA: 78232907928.18.32C6B42 Received: from mail-qv1-f43.google.com (mail-qv1-f43.google.com [209.85.219.43]) by imf11.hostedemail.com (Postfix) with ESMTP id E0DE7200107C for ; Wed, 9 Jun 2021 04:29:59 +0000 (UTC) Received: by mail-qv1-f43.google.com with SMTP id l3so5108686qvl.0 for ; Tue, 08 Jun 2021 21:30:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:in-reply-to:message-id:references :mime-version; bh=+ThT1ycF8YLamnlD2Lza4I95kCWi6MvYxYZGgNS2X9s=; b=M4FcLOpy9iMQviGUShyo5Ubyn4BAdjZbD/36Spa6wZwN1yu5XkVBovKgUgOOm4MHYN +9rbHmJQ/QlxN5lmNPNE3ZqD9ob3o4BQUbbZqH27OMI+hmD7E7dxL0cQtcs4kpFSoLoI P7PiaxSFx4nK0py9c5yw5WAE/sM5FhuO2JorxLDfrkcnT5+c/jqm/mkAuZHeQkuoAD1X L6J1LLhknct1mGv8LxU8JU1rzDXQxbTSoCSRb64AvCvf5inp1NLFrttpIrJGlASZGgMZ OFZ9xGwdHrxIhM+v2MnAMcpfe1yTuJbdi09tFELDTC1bju9G9LfX0cO16l28YT3aqrnI wZ9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:in-reply-to:message-id :references:mime-version; bh=+ThT1ycF8YLamnlD2Lza4I95kCWi6MvYxYZGgNS2X9s=; b=De5TzC7qcdLpjnJk4FauQdclXd9yqR47DP8kDcKUGv/bLD9kamm7aIQTS7z5gAGD02 yVdVsSDCJuHEkcm58QYQTBy2r97oQlEPBOopcAfx6KwFNUk3Ze/ofxgmuBqd/N73kzcG RMgaSt7taSQ7yct7LH+is10r1iq7BtY+X47lYJelnNc3NtUp7VlnMU1g+HMpzjkVaReM U2xKd+lwZcyx07RadR79LEoyMMFPUufhVmfjyZeiduYh+hsUUBfELzSORbbNkKUAWmSb G5VPH+3qIus9ZWPKYuo6P/5Gb5S5vMJzvXr6lxOggqBCiD8UZayyG/EevEWbJub6gR7D EzDQ== X-Gm-Message-State: AOAM533pr7Gii16pP4F+i58CwdpUwZViXVsJEiPxXVF7wMRNkePmRXhp +1oBM1VQS7F2CXldxAWLhqm9AQ== X-Google-Smtp-Source: ABdhPJzQmPE98FZfl1GR4aklzUHZDiAU5rCGYrSbno/A3T1De47msweq94P8b3ysrWw+Si6IILLoOg== X-Received: by 2002:a0c:eda5:: with SMTP id h5mr3924907qvr.26.1623213003254; Tue, 08 Jun 2021 21:30:03 -0700 (PDT) Received: from ripple.attlocal.net (172-10-233-147.lightspeed.sntcca.sbcglobal.net. [172.10.233.147]) by smtp.gmail.com with ESMTPSA id k124sm13126699qkc.132.2021.06.08.21.30.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Jun 2021 21:30:02 -0700 (PDT) Date: Tue, 8 Jun 2021 21:30:00 -0700 (PDT) From: Hugh Dickins X-X-Sender: hugh@ripple.anvils To: Andrew Morton cc: Hugh Dickins , "Kirill A. Shutemov" , Yang Shi , Wang Yugui , Matthew Wilcox , Naoya Horiguchi , Alistair Popple , Ralph Campbell , Zi Yan , Miaohe Lin , Minchan Kim , Jue Wang , Peter Xu , Jan Kara , Shakeel Butt , Oscar Salvador , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 10/10] mm: hwpoison_user_mappings() try_to_unmap() with TTU_SYNC In-Reply-To: Message-ID: <329c28ed-95df-9a2c-8893-b444d8a6d340@google.com> References: MIME-Version: 1.0 Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=google.com header.s=20161025 header.b=M4FcLOpy; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf11.hostedemail.com: domain of hughd@google.com designates 209.85.219.43 as permitted sender) smtp.mailfrom=hughd@google.com X-Rspamd-Server: rspam02 X-Stat-Signature: qzudn6bmi7t98za8qm5d693zseg1ik7b X-Rspamd-Queue-Id: E0DE7200107C X-HE-Tag: 1623212999-921600 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: TTU_SYNC prevents an unlikely race, when try_to_unmap() returns shortly before the page is accounted as unmapped. It is unlikely to coincide with hwpoisoning, but now that we have the flag, hwpoison_user_mappings() would do well to use it. Signed-off-by: Hugh Dickins Acked-by: Kirill A. Shutemov Acked-by: Naoya Horiguchi --- Patch added since the v1 series was posted. mm/memory-failure.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/memory-failure.c b/mm/memory-failure.c index b6806e446567..e16edefca523 100644 --- a/mm/memory-failure.c +++ b/mm/memory-failure.c @@ -1060,7 +1060,7 @@ static int get_hwpoison_page(struct page *p, unsigned long flags, static bool hwpoison_user_mappings(struct page *p, unsigned long pfn, int flags, struct page **hpagep) { - enum ttu_flags ttu = TTU_IGNORE_MLOCK; + enum ttu_flags ttu = TTU_IGNORE_MLOCK | TTU_SYNC; struct address_space *mapping; LIST_HEAD(tokill); bool unmap_success;