Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp1303118ybg; Wed, 29 Jul 2020 10:34:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy4cs1KCfFNhjiLzFcw6xrML3SQPxyIayxSAyhgIz09Fp7Q3NMLbgJS5i+ivhKQKyEwWyF7 X-Received: by 2002:a05:6402:17f7:: with SMTP id t23mr1365323edy.301.1596044053530; Wed, 29 Jul 2020 10:34:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596044053; cv=none; d=google.com; s=arc-20160816; b=EsoC8AwzE20kpm4N0adLJxycblDtt2+uS1NKNCYd3YvUVzfrU6NPCBERRd/DYEZL/R J1OAbLR9WM9bH2DkZDn+9DNy13u20iP/W2qkCoKXYPyP1HKo8Q/fxgrekzjx6KSiTRLK y4fFzgHV1bmc48qSI/YbTHRFbOkrTJGu7S+ljY5F9uPZ6Gl7zEXAFEFXkEM4IJ6olV1p eviXe4PsD+V5ipWAEAeHUx+w7AAo/Lpsql+nlmLCxEIRIgKqiYppmsP2LAsoWRiJucqY nGIsaQfzqlvG/5V4rFbmPOaraPv7oq1ADat2gLJvYDgNGF+sOhtTpYNhDKTMSY1gFbtI 0nXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=JJUNuxTpEfKxSphfXOUQrWBFW3Caubzknw2AmT6q9+8=; b=UcuQkdSZBtqb4tlSqXFsne8BhZjrXJq78a0Mmsye54jl0icS8ht2VZK5KwZKQ+68IV R8/XgcmW3yn0eBbCjlHECf2lxjmUvPORGRJ5hT0hMVaVmgt/JfroCDuZSekr2wLaMwqD Uqo0T+pJQen/BTo1asB66kBNBd74LBLrdF55lS6k8XIUjxGwtjw+3loUIq/bRYI1Cpoq 16AjhWRyQw7QntgWxaNFgZeC8JkfMbMIDFSzRr8vcviQxnFWrWY+ltJRndIbZxfMTK0Y ef1NlMyafSB64bRt5gz2Z6NfsXIUYTay2DH0AcWYNQElNSue1SoVOtEyhsgOYjcLSSvU ejrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b=wAJv0XWR; 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=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u21si1701562edi.143.2020.07.29.10.33.50; Wed, 29 Jul 2020 10:34:13 -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=@oracle.com header.s=corp-2020-01-29 header.b=wAJv0XWR; 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=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726502AbgG2Rd0 (ORCPT + 99 others); Wed, 29 Jul 2020 13:33:26 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:52770 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726365AbgG2Rd0 (ORCPT ); Wed, 29 Jul 2020 13:33:26 -0400 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 06THWq3N173710; Wed, 29 Jul 2020 17:33:14 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=corp-2020-01-29; bh=JJUNuxTpEfKxSphfXOUQrWBFW3Caubzknw2AmT6q9+8=; b=wAJv0XWR5J39m0gNC3gKShv9vJ/fEL2t1jm5SSuK3kcvA1GtwU8qxz3eybXFgQ3V31QX sjwSVCrg2+cEcDrAD7HbHI1JALxD/77QW1grGqwXPvW0cbCQm9EOWEMwd3+AAde2qY0J wVIVHgtSQcm3MDVnMYoTGaVErR4/iC9/+NEj1p+xor6PYzgyb+ns5hSQcnEzF8s6lL77 Qbwnzjl7XlGIg7FZTLHMfsvkOZGDnp5Pn1nZKWZ2FTVTyJjssik+Gv1Mu2iiDWSnwZL7 mGcg/wMqhLGXkNVGgWhdjN2f2ehrxG5zNQL92i3in9VDG9qgxFY3pBTMfKI3WsMSd+Iy mQ== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by userp2130.oracle.com with ESMTP id 32hu1jf1qa-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 29 Jul 2020 17:33:14 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 06THMUM7127756; Wed, 29 Jul 2020 17:31:13 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserp3020.oracle.com with ESMTP id 32hu5xhqmq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 29 Jul 2020 17:31:13 +0000 Received: from abhmp0020.oracle.com (abhmp0020.oracle.com [141.146.116.26]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 06THVBD6015116; Wed, 29 Jul 2020 17:31:11 GMT Received: from [192.168.2.112] (/50.38.35.18) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 29 Jul 2020 10:31:07 -0700 Subject: Re: [PATCH v1 2/6] mm/page_isolation: don't dump_page(NULL) in set_migratetype_isolate() To: David Hildenbrand , linux-kernel@vger.kernel.org Cc: virtualization@lists.linux-foundation.org, linux-mm@kvack.org, Andrew Morton , Michal Hocko , "Michael S.Tsirkin" References: <20200630142639.22770-1-david@redhat.com> <20200630142639.22770-3-david@redhat.com> From: Mike Kravetz Message-ID: <6a05470a-75be-e895-dff6-ed494af8d6d9@oracle.com> Date: Wed, 29 Jul 2020 10:31:06 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20200630142639.22770-3-david@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9697 signatures=668679 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 adultscore=0 bulkscore=0 malwarescore=0 mlxscore=0 spamscore=0 mlxlogscore=999 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2007290119 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9697 signatures=668679 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 clxscore=1011 malwarescore=0 spamscore=0 suspectscore=0 bulkscore=0 priorityscore=1501 phishscore=0 mlxlogscore=999 lowpriorityscore=0 impostorscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2007290120 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 6/30/20 7:26 AM, David Hildenbrand wrote: > Right now, if we have two isolations racing, we might trigger the > WARN_ON_ONCE() and to dump_page(NULL), dereferencing NULL. Let's just > return directly. Just curious, what call path has the WARN_ON_ONCE()/dump_page(NULL)? > > In the future, we might want to report -EAGAIN to the caller instead, as > this could indicate a temporary isolation failure only. > > Cc: Andrew Morton > Cc: Michal Hocko > Cc: Michael S. Tsirkin > Signed-off-by: David Hildenbrand Hi David, That 'return -EAGAIN' was added as a sort of synchronization mechanism. See commit message for 2c7452a075d4d. Before adding the 'return -EAGAIN', I could create races which would abandon isolated pageblocks. Repeating those races over and over would result in a good chunk of system memory being isolated and unusable. Admittedly, these races are rare and I had to work really hard to produce them. I'll try to find my testing mechanism. My concern is reintroducing this abandoning of pageblocks. I have not looked further in your series to see if this potentially addressed later. If not, then we should not remove the return code. -- Mike Kravetz > --- > mm/page_isolation.c | 8 +++++--- > 1 file changed, 5 insertions(+), 3 deletions(-) > > diff --git a/mm/page_isolation.c b/mm/page_isolation.c > index f6d07c5f0d34d..553b49a34cf71 100644 > --- a/mm/page_isolation.c > +++ b/mm/page_isolation.c > @@ -29,10 +29,12 @@ static int set_migratetype_isolate(struct page *page, int migratetype, int isol_ > /* > * We assume the caller intended to SET migrate type to isolate. > * If it is already set, then someone else must have raced and > - * set it before us. Return -EBUSY > + * set it before us. > */ > - if (is_migrate_isolate_page(page)) > - goto out; > + if (is_migrate_isolate_page(page)) { > + spin_unlock_irqrestore(&zone->lock, flags); > + return -EBUSY; > + } > > /* > * FIXME: Now, memory hotplug doesn't call shrink_slab() by itself. >