Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753311AbcKUIS6 (ORCPT ); Mon, 21 Nov 2016 03:18:58 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:39254 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753225AbcKUIS4 (ORCPT ); Mon, 21 Nov 2016 03:18:56 -0500 Subject: Re: [HMM v13 03/18] mm/ZONE_DEVICE/free_hot_cold_page: catch ZONE_DEVICE pages To: =?UTF-8?B?SsOpcsO0bWUgR2xpc3Nl?= , akpm@linux-foundation.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org References: <1479493107-982-1-git-send-email-jglisse@redhat.com> <1479493107-982-4-git-send-email-jglisse@redhat.com> Cc: John Hubbard , Dan Williams , Ross Zwisler From: Anshuman Khandual Date: Mon, 21 Nov 2016 13:48:26 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 MIME-Version: 1.0 In-Reply-To: <1479493107-982-4-git-send-email-jglisse@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16112108-0012-0000-0000-000001EAA447 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16112108-0013-0000-0000-00000678EA2D Message-Id: <5832ADD2.5000507@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-11-21_06:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=2 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1609300000 definitions=main-1611210149 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1193 Lines: 33 On 11/18/2016 11:48 PM, Jérôme Glisse wrote: > Catch page from ZONE_DEVICE in free_hot_cold_page(). This should never > happen as ZONE_DEVICE page must always have an elevated refcount. > > This is to catch refcounting issues in a sane way for ZONE_DEVICE pages. > > Signed-off-by: Jérôme Glisse > Cc: Dan Williams > Cc: Ross Zwisler > --- > mm/page_alloc.c | 10 ++++++++++ > 1 file changed, 10 insertions(+) > > diff --git a/mm/page_alloc.c b/mm/page_alloc.c > index 0fbfead..09b2630 100644 > --- a/mm/page_alloc.c > +++ b/mm/page_alloc.c > @@ -2435,6 +2435,16 @@ void free_hot_cold_page(struct page *page, bool cold) > unsigned long pfn = page_to_pfn(page); > int migratetype; > > + /* > + * This should never happen ! Page from ZONE_DEVICE always must have an > + * active refcount. Complain about it and try to restore the refcount. > + */ > + if (is_zone_device_page(page)) { > + VM_BUG_ON_PAGE(is_zone_device_page(page), page); > + page_ref_inc(page); > + return; > + } This fixes an issue in the existing ZONE_DEVICE code, should not this patch be sent separately not in this series ?