Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752042AbdLAI5z (ORCPT ); Fri, 1 Dec 2017 03:57:55 -0500 Received: from mx1.redhat.com ([209.132.183.28]:37570 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751444AbdLAI5y (ORCPT ); Fri, 1 Dec 2017 03:57:54 -0500 Date: Fri, 1 Dec 2017 16:57:49 +0800 From: Dave Young To: Pavel Tatashin Cc: linux-kernel@vger.kernel.org, Linux Memory Management List , Andrew Morton Subject: Re: [PATCH] mm: check pfn_valid first in zero_resv_unavail Message-ID: <20171201085749.GB2291@dhcp-128-65.nay.redhat.com> References: <20171130060431.GA2290@dhcp-128-65.nay.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.1 (2017-09-22) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Fri, 01 Dec 2017 08:57:54 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1066 Lines: 33 On 11/30/17 at 12:25pm, Pavel Tatashin wrote: > Hi Dave, > > Because unavailable memory can be in the middle of a section, I think > a proper fix would be to do pfn_valid() check only at the beginning of > section. Otherwise, we might miss zeroing a struct page is in the > middle of a section but pfn_valid() could potentially return false as > that page is indeed invalid. > > So, I would do something like this: > + if (!pfn_valid(ALIGN_DOWN(pfn, pageblock_nr_pages)) > + continue; > > Could you please test if this fix works? It works. > > We should really look into this memory that is reserved by memblock > but Linux is not aware of physical backing, so far I know that only > x86 can have such scenarios, so we should really see if the problem > can be addressed on x86 platform. It would be very nice if we could > enforce inside memblock to reserve only memory that has real physical > backing. Will resend with your suggestion along with patch log changes. > > Thank you, > Pavel Thanks Dave