Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp5145068pxj; Wed, 9 Jun 2021 10:08:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxkdcut3fVq7IHXKD61gsRgTWkR1tangzgt2W4xaneRlR6q+X+a4BtjSyggHefrxaYD0XGW X-Received: by 2002:aa7:c782:: with SMTP id n2mr442740eds.77.1623258487937; Wed, 09 Jun 2021 10:08:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623258487; cv=none; d=google.com; s=arc-20160816; b=mYgxHR8NaYbmFwhoa9QPox7Lt16AhtcAgqSz7MQGzBzOYbNocrY2qFW6hawdGTKCBl nLALgI6OzhkM0CnWhos8aqUhzmRk6ufCERiSMV933f9SQbXbpqsP1C8uonWjrcb2r0xo IFOWnlU3RdETPpq/PjLtoTTTP4BXJB1LoY9oK77ntdDMXyV58QMP6J9g6k9s7zkitLnv zpfL7Bg8OyV49yxbdT6TnY4pb1/kdkjN/rK0kRQb+creJ6+QmmYBDNgwnDyX2ULO2NgP aILGK0M22WU9xLyFEDwvHO6CyNr+I3+JrKXL2ST+WNiiFFNDDB04ogflG0JSIThRLnsC Ki9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:message-id:in-reply-to :subject:cc:to:from:date:dkim-signature; bh=+ThT1ycF8YLamnlD2Lza4I95kCWi6MvYxYZGgNS2X9s=; b=F/agXkgwP1OChnfpIvg2ObqE0Uyh0cOMc6brLFll1x3gQyLuvhx8gHUu/MnCedV/Ww Fo4STq7OcB35sgCbOyjEDhcEJEgG0Kqot6NT2H6+ROuwqQbIhs7YxoaPZFCG44MSKJMH wVnCsTBggpH2vWO6cxWwJRuKgmreARhNf7nbq4Bz5mFhx4cLjfDE3x32COZ5qyiGbJHj KxOEjTpcBcr/mrCE+qCi3tuisw95URQer5vTEOL0yjZNmzI18aQ+ij3KiWP4MhfwpCqY 0JG0IVhsY8/gnIDDtRSUezHA4EiBy9Lk413aslHsZU4oT7yOxwPHTfKLKMP7vobvp9oS GHzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=M4FcLOpy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c25si234697ejj.528.2021.06.09.10.07.42; Wed, 09 Jun 2021 10:08:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=M4FcLOpy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233526AbhFIEcO (ORCPT + 99 others); Wed, 9 Jun 2021 00:32:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47106 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231268AbhFIEcM (ORCPT ); Wed, 9 Jun 2021 00:32:12 -0400 Received: from mail-qv1-xf32.google.com (mail-qv1-xf32.google.com [IPv6:2607:f8b0:4864:20::f32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3FC95C061574 for ; Tue, 8 Jun 2021 21:30:04 -0700 (PDT) Received: by mail-qv1-xf32.google.com with SMTP id w4so4720428qvr.11 for ; Tue, 08 Jun 2021 21:30:04 -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=aYwpgtpw+PA86Jk8tV3O3lDle8kXNs9HJne5eAXYUpLXTf7vJ83V3OIzh3RD5TTmRR NnRrouFYOWfnD68vKbZ9PTdSMyrGv2vLHU//QSXi/+UauqCb171BX3PbbZ3i9vFaQGI1 jedYa5WuR1RV3k2t2Ukdys5xHAB7/ZdTAvZ3+9Ow/2dwRJ4R/IEIA6uYVQT+7ZhlfQef 2ktyHa7ZmfiYC9hE7Mjoo3Dymz/DmGEpw+CZLvMhfbpnEKoJv3bMPA1Ds4lNlBouy/o0 7oa45kOcOrpNibjRatC7KwPkd5IMN4/WQZc/pfcqEJmv0P21XugkDy7q2wLBlDKmvyfw A2kQ== X-Gm-Message-State: AOAM532KJ+5ECIwj8qSOVPaF161GHtGzvvs6O17meT8IXBrH4zY7Obsq 0Dbk/QDZtag+i7r0u5Z/Vf4+ww== 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 Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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; -- 2.26.2