From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933513AbdJQNDf (ORCPT ); Tue, 17 Oct 2017 09:03:35 -0400 Received: from mx2.suse.de ([195.135.220.15]:35631 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933230AbdJQNDc (ORCPT ); Tue, 17 Oct 2017 09:03:32 -0400 Subject: Re: [PATCH 2/2] mm, page_alloc: fail has_unmovable_pages when seeing reserved pages To: Michal Hocko Cc: linux-mm@kvack.org, Michael Ellerman , Andrew Morton , KAMEZAWA Hiroyuki , Reza Arbab , Yasuaki Ishimatsu , qiuxishi@huawei.com, Igor Mammedov , Vitaly Kuznetsov , LKML References: <20171013115835.zaehapuucuzl2vlv@dhcp22.suse.cz> <20171013120013.698-1-mhocko@kernel.org> <20171013120013.698-2-mhocko@kernel.org> <20171013120756.jeopthigbmm3c7bl@dhcp22.suse.cz> From: Vlastimil Babka Message-ID: <7d389744-13c9-4f01-106a-902af61643e1@suse.cz> Date: Tue, 17 Oct 2017 15:03:30 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <20171013120756.jeopthigbmm3c7bl@dhcp22.suse.cz> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/13/2017 02:07 PM, Michal Hocko wrote: > On Fri 13-10-17 14:04:08, Vlastimil Babka wrote: >> On 10/13/2017 02:00 PM, Michal Hocko wrote: >>> From: Michal Hocko >>> >>> Reserved pages should be completely ignored by the core mm because they >>> have a special meaning for their owners. has_unmovable_pages doesn't >>> check those so we rely on other tests (reference count, or PageLRU) to >>> fail on such pages. Althought this happens to work it is safer to simply >>> check for those explicitly and do not rely on the owner of the page >>> to abuse those fields for special purposes. >>> >>> Please note that this is more of a further fortification of the code >>> rahter than a fix of an existing issue. >>> >>> Signed-off-by: Michal Hocko >>> --- >>> mm/page_alloc.c | 3 +++ >>> 1 file changed, 3 insertions(+) >>> >>> diff --git a/mm/page_alloc.c b/mm/page_alloc.c >>> index ad0294ab3e4f..a8800b0a5619 100644 >>> --- a/mm/page_alloc.c >>> +++ b/mm/page_alloc.c >>> @@ -7365,6 +7365,9 @@ bool has_unmovable_pages(struct zone *zone, struct page *page, int count, >>> >>> page = pfn_to_page(check); >>> >>> + if (PageReferenced(page)) >> >> "Referenced" != "Reserved" > > Dohh, you are right of course. I blame auto-completion ;) but I am lame > in fact... > --- > From 44b20bdb03846bc5fd79c883d16b8f3aa436878f Mon Sep 17 00:00:00 2001 > From: Michal Hocko > Date: Fri, 13 Oct 2017 13:55:21 +0200 > Subject: [PATCH] mm, page_alloc: fail has_unmovable_pages when seeing reserved > pages > > Reserved pages should be completely ignored by the core mm because they > have a special meaning for their owners. has_unmovable_pages doesn't > check those so we rely on other tests (reference count, or PageLRU) to > fail on such pages. Althought this happens to work it is safer to simply > check for those explicitly and do not rely on the owner of the page > to abuse those fields for special purposes. > > Please note that this is more of a further fortification of the code > rahter than a fix of an existing issue. > > Signed-off-by: Michal Hocko Acked-by: Vlastimil Babka > --- > mm/page_alloc.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/mm/page_alloc.c b/mm/page_alloc.c > index ad0294ab3e4f..5b4d85ae445c 100644 > --- a/mm/page_alloc.c > +++ b/mm/page_alloc.c > @@ -7365,6 +7365,9 @@ bool has_unmovable_pages(struct zone *zone, struct page *page, int count, > > page = pfn_to_page(check); > > + if (PageReserved(page)) > + return true; > + > /* > * Hugepages are not in LRU lists, but they're movable. > * We need not scan over tail pages bacause we don't > From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f198.google.com (mail-wr0-f198.google.com [209.85.128.198]) by kanga.kvack.org (Postfix) with ESMTP id D50EE6B0069 for ; Tue, 17 Oct 2017 09:03:32 -0400 (EDT) Received: by mail-wr0-f198.google.com with SMTP id n4so785514wrb.8 for ; Tue, 17 Oct 2017 06:03:32 -0700 (PDT) Received: from mx2.suse.de (mx2.suse.de. [195.135.220.15]) by mx.google.com with ESMTPS id m22si1994313wrb.94.2017.10.17.06.03.31 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 17 Oct 2017 06:03:31 -0700 (PDT) Subject: Re: [PATCH 2/2] mm, page_alloc: fail has_unmovable_pages when seeing reserved pages References: <20171013115835.zaehapuucuzl2vlv@dhcp22.suse.cz> <20171013120013.698-1-mhocko@kernel.org> <20171013120013.698-2-mhocko@kernel.org> <20171013120756.jeopthigbmm3c7bl@dhcp22.suse.cz> From: Vlastimil Babka Message-ID: <7d389744-13c9-4f01-106a-902af61643e1@suse.cz> Date: Tue, 17 Oct 2017 15:03:30 +0200 MIME-Version: 1.0 In-Reply-To: <20171013120756.jeopthigbmm3c7bl@dhcp22.suse.cz> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: owner-linux-mm@kvack.org List-ID: To: Michal Hocko Cc: linux-mm@kvack.org, Michael Ellerman , Andrew Morton , KAMEZAWA Hiroyuki , Reza Arbab , Yasuaki Ishimatsu , qiuxishi@huawei.com, Igor Mammedov , Vitaly Kuznetsov , LKML On 10/13/2017 02:07 PM, Michal Hocko wrote: > On Fri 13-10-17 14:04:08, Vlastimil Babka wrote: >> On 10/13/2017 02:00 PM, Michal Hocko wrote: >>> From: Michal Hocko >>> >>> Reserved pages should be completely ignored by the core mm because they >>> have a special meaning for their owners. has_unmovable_pages doesn't >>> check those so we rely on other tests (reference count, or PageLRU) to >>> fail on such pages. Althought this happens to work it is safer to simply >>> check for those explicitly and do not rely on the owner of the page >>> to abuse those fields for special purposes. >>> >>> Please note that this is more of a further fortification of the code >>> rahter than a fix of an existing issue. >>> >>> Signed-off-by: Michal Hocko >>> --- >>> mm/page_alloc.c | 3 +++ >>> 1 file changed, 3 insertions(+) >>> >>> diff --git a/mm/page_alloc.c b/mm/page_alloc.c >>> index ad0294ab3e4f..a8800b0a5619 100644 >>> --- a/mm/page_alloc.c >>> +++ b/mm/page_alloc.c >>> @@ -7365,6 +7365,9 @@ bool has_unmovable_pages(struct zone *zone, struct page *page, int count, >>> >>> page = pfn_to_page(check); >>> >>> + if (PageReferenced(page)) >> >> "Referenced" != "Reserved" > > Dohh, you are right of course. I blame auto-completion ;) but I am lame > in fact... > --- > From 44b20bdb03846bc5fd79c883d16b8f3aa436878f Mon Sep 17 00:00:00 2001 > From: Michal Hocko > Date: Fri, 13 Oct 2017 13:55:21 +0200 > Subject: [PATCH] mm, page_alloc: fail has_unmovable_pages when seeing reserved > pages > > Reserved pages should be completely ignored by the core mm because they > have a special meaning for their owners. has_unmovable_pages doesn't > check those so we rely on other tests (reference count, or PageLRU) to > fail on such pages. Althought this happens to work it is safer to simply > check for those explicitly and do not rely on the owner of the page > to abuse those fields for special purposes. > > Please note that this is more of a further fortification of the code > rahter than a fix of an existing issue. > > Signed-off-by: Michal Hocko Acked-by: Vlastimil Babka > --- > mm/page_alloc.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/mm/page_alloc.c b/mm/page_alloc.c > index ad0294ab3e4f..5b4d85ae445c 100644 > --- a/mm/page_alloc.c > +++ b/mm/page_alloc.c > @@ -7365,6 +7365,9 @@ bool has_unmovable_pages(struct zone *zone, struct page *page, int count, > > page = pfn_to_page(check); > > + if (PageReserved(page)) > + return true; > + > /* > * Hugepages are not in LRU lists, but they're movable. > * We need not scan over tail pages bacause we don't > -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org