Received: by 2002:a05:6a10:a852:0:0:0:0 with SMTP id d18csp916608pxy; Wed, 5 May 2021 17:58:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx2zC9u4PkQ+GUdoXEgEeDYStNtQdvCwVt5DK1XDoFUejVhbbQRVONSOaTeyIxbsr70eItS X-Received: by 2002:a17:907:2d0c:: with SMTP id gs12mr1505217ejc.173.1620262720418; Wed, 05 May 2021 17:58:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620262720; cv=none; d=google.com; s=arc-20160816; b=SifkwOxWHcuuF9Fj+xUeY58y2QqTzg2LxcLgPKB91XDttLGvSUxdy8oSnAQl3Tzmbl P6usbfCZ88we5HayLnVfAetWI3RBTaxu5+iumxqUuquJ4Je6mXQNygqIVnqm1oUgh5zz A12NbthDRdIBA75SpvGVtEyxWP0mkGissUBzrOjuc0SP81w0C2yoGtXA5ogPzFy2pfrm oqmmx2K7kj/w6LDcOkMqLKQzSziHqJSn76wAaQPMzqiV1zgYwHYhYn6/iBB3Od8F+YQJ jTOSavYa/nPa3autkVMUhKfkHgHmz3K+QZ2upahfKE/klwn0dow7x9mzP5bRXeloe/Ww x7Og== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=zk/c0XHOeadVbN4fAUhBEa54gSp8+5OV5keL61KS1hc=; b=KHynPM1xYYde1mGD+7sqXfrHXPGFUQj2rvpOb8d8Y7wZxRSMU1A09HDRr7CSIxqM6y MQoRnDUOQNChZa2UeupjL+z1GMIxAguFW/SXMKGzgwb+bUJIvql4GMXS1akISs/9i1yy cmIoxmu3i50Cs6LYZqr2O8F5tbaGgvEBX7SDHYFd0njCijObaKolutaCxGxUP0m+FfJG vEKTByD95wUDqF37sg7GMZfFywPbu28uYOBj0oPxcVDE4Mr1g3w1t7yb7mvzdGG6rYwI M4enrlMcfZTnLJpXvctj5PiX27u1coZC91ieiJZq6uLNGsNkJdNYYyFgQ7OrFVo+bKNN Bh1Q== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e18si796051ejb.261.2021.05.05.17.58.16; Wed, 05 May 2021 17:58:40 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229646AbhEFA5S (ORCPT + 99 others); Wed, 5 May 2021 20:57:18 -0400 Received: from mail.kingsoft.com ([114.255.44.146]:3059 "EHLO mail.kingsoft.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S229465AbhEFA5R (ORCPT ); Wed, 5 May 2021 20:57:17 -0400 X-AuditID: 0a580155-c83ff700000401e3-d7-60933eaed698 Received: from mail.kingsoft.com (localhost [10.88.1.79]) (using TLS with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mail.kingsoft.com (SMG-2-NODE-85) with SMTP id BE.AA.00483.EAE33906; Thu, 6 May 2021 08:56:14 +0800 (HKT) Received: from alex-virtual-machine (10.88.1.103) by KSBJMAIL4.kingsoft.cn (10.88.1.79) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Thu, 6 May 2021 08:56:12 +0800 Date: Thu, 6 May 2021 08:56:11 +0800 From: Aili Yao To: Michal Hocko CC: David Hildenbrand , , Andrew Morton , "Michael S. Tsirkin" , Jason Wang , Alexey Dobriyan , Mike Rapoport , "Matthew Wilcox (Oracle)" , Oscar Salvador , "Roman Gushchin" , Alex Shi , Steven Price , Mike Kravetz , Jiri Bohac , "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , "Wei Liu" , Naoya Horiguchi , , , , , Subject: Re: [PATCH v1 3/7] mm: rename and move page_is_poisoned() Message-ID: <20210506085611.1ec21588@alex-virtual-machine> In-Reply-To: References: <20210429122519.15183-1-david@redhat.com> <20210429122519.15183-4-david@redhat.com> <0710d8d5-2608-aeed-10c7-50a272604d97@redhat.com> Organization: kingsoft X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.30; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.88.1.103] X-ClientProxiedBy: KSBJMAIL1.kingsoft.cn (10.88.1.31) To KSBJMAIL4.kingsoft.cn (10.88.1.79) X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrNIsWRmVeSWpSXmKPExsXCFcHor7vObnKCQfN0JovpjV4Wc9avYbNY d7yL2eLr+l9AYtIFNotr2z0sll36zGRx4+BmNosnq7eyW+zZe5LFYurED2wWl3fNYbO4t+Y/ q8X9PgeLj/uDLf7/esVqcbHxAKPFmWlFFkfWb2eyaDzyns3i7eGDzBbLz85jszi86RaTxe8f QI3PWq+yOEh6rJm3htFjYvM7do+ds+6ye2xeoeWxaVUnm8emT5PYPU7M+M3isfOhpcfkG8sZ PVp3/GX3eHF1I4vHx6e3WDze77vK5rF+y1UWjzMLjgB1nq4OEIzisklJzcksSy3St0vgyth8 dwJrwTaxiuNzD7E0MG4X7GLk4JAQMJF49Sy7i5GLQ0hgOpPEmf//mboYOYGcZ4wSq09YgNgs AioSh35dAIuzCahK7Lo3ixXEFhFQkujavJMNpJlZoJldovnnBGaQhLCAk8Tx5zcZQWxeASuJ q8ffgNmcAnoSB+ZfZ4XYdpdR4k77DbBJ/AJiEr1XQDaDXGQv8Xi9IkSvoMTJmU9YQGxmAR2J E6uOMUPY8hLb385hhjhUUeLwkl/sILYEUPzu7+mMEHasRNOBW2wTGIVnIRk1C8moWUhGLWBk XsXIUpybbrSJEZIeQncwzmj6qHeIkYmD8RCjBAezkghvwdr+BCHelMTKqtSi/Pii0pzU4kOM 0hwsSuK87IVdCUIC6YklqdmpqQWpRTBZJg5OqQYmngff/NI6OLyu1RzY/mjunat8m+ZsYJ7u cy59a0XvYen+rYvWBD0IMUh++tHARml99imXvEOS61+n7YydEWt69WWSvIeG/bH7LeapHLdt TxfUqu6R2v+mW1yias7tY+G1Prsjc5ZwClrVvH2fWJS28f6JwGd2/59sfHFbc8nCuIMxge8F evm3v7maKvX3iLq/wdxisxyb6ZcvH+BuP+f47NbeI3bykfaZ5iHLpQ6YrV206dwFH2H9HTM2 z4r0nHunqsx38uJYrUSpEhH3e0zpF0rm7aid0DjhB8t6pg9hNZMzdP77BZeVr1yiFK8j/v10 1u56nYyFHtqPRRJLLcplBa/sKtsTMfHh8vf/501crcRSnJFoqMVcVJwIAPTMT+t+AwAA Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 5 May 2021 15:27:39 +0200 Michal Hocko wrote: > On Wed 05-05-21 15:17:53, David Hildenbrand wrote: > > On 05.05.21 15:13, Michal Hocko wrote: > > > On Thu 29-04-21 14:25:15, David Hildenbrand wrote: > > > > Commit d3378e86d182 ("mm/gup: check page posion status for coredump.") > > > > introduced page_is_poisoned(), however, v5 [1] of the patch used > > > > "page_is_hwpoison()" and something went wrong while upstreaming. Rename the > > > > function and move it to page-flags.h, from where it can be used in other > > > > -- kcore -- context. > > > > > > > > Move the comment to the place where it belongs and simplify. > > > > > > > > [1] https://lkml.kernel.org/r/20210322193318.377c9ce9@alex-virtual-machine > > > > > > > > Signed-off-by: David Hildenbrand > > > > > > I do agree that being explicit about hwpoison is much better. Poisoned > > > page can be also an unitialized one and I believe this is the reason why > > > you are bringing that up. > > > > I'm bringing it up because I want to reuse that function as state above :) > > > > > > > > But you've made me look at d3378e86d182 and I am wondering whether this > > > is really a valid patch. First of all it can leak a reference count > > > AFAICS. Moreover it doesn't really fix anything because the page can be > > > marked hwpoison right after the check is done. I do not think the race > > > is feasible to be closed. So shouldn't we rather revert it? > > > > I am not sure if we really care about races here that much here? I mean, > > essentially we are racing with HW breaking asynchronously. Just because we > > would be synchronizing with SetPageHWPoison() wouldn't mean we can stop HW > > from breaking. > > Right > > > Long story short, this should be good enough for the cases we actually can > > handle? What am I missing? > > I am not sure I follow. My point is that I fail to see any added value > of the check as it doesn't prevent the race (it fundamentally cannot as > the page can be poisoned at any time) but the failure path doesn't > put_page which is incorrect even for hwpoison pages. Sorry, I have something to say: I have noticed the ref count leak in the previous topic ,but I don't think it's a really matter. For memory recovery case for user pages, we will keep one reference to the poison page so the error page will not be freed to buddy allocator. which can be checked in memory_faulure() function. For the case here, the reference count for error page may be greater than one as it's not unmmapped successfully and may shared. we take a reference for that page will not result some really mattering issue. The only break I can think for this leak is that we will fail to unpoison the error page for test purpose. Thanks! Aili Yao