Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp4506148imm; Mon, 18 Jun 2018 16:38:05 -0700 (PDT) X-Google-Smtp-Source: ADUXVKK2P0QY0GXng74rA2oXivmHKgP5lyd5uE/GPxYGQN+2Mp4WByUAdJaHo/K4Ovt8mtyIdTTf X-Received: by 2002:a62:f407:: with SMTP id r7-v6mr15419717pff.47.1529365085747; Mon, 18 Jun 2018 16:38:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529365085; cv=none; d=google.com; s=arc-20160816; b=HaivZUwvZ918r8msPw25sg9CNMQJZxwAJ3CEMK1vEJTkwnafkCvLgFAbMws/vCneBZ chPszpFbXMhKoYudMPPWIPDRtWI97+/fg9auoOVcmntC9COXBTloRc0DjCGmhb49Ck4c xTJ2994I0G7imEW+L8m5Ad7vtgSPQaEpW+dCCjd+M2vAuwZIpe2p4w+wV51vc2Uoan1M g6paubRp6MiWIVONcui5d6Rs4lnKybfnKyMXSzbLQ0F7X5YiFLYk2QRFxPKCP3F+Ui0b 7RhB0tNEVj7YLfbs4wuzPJMyG6RC2+5zSKRFG62vqp4hHyiBOWsrAMTeVlNy6NBf/8Yy U3CA== 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:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :arc-authentication-results; bh=ACMLckqkHidoAmHfm8AkrYUCjD3WiuwUqIADijAE5wg=; b=yXRJv9745kv3wRVXNrqthGmQVH2SJpZS54MB7O3IRiP5K/8U5AVKMaTGyI4agWtNiN Jq/tfGwBeZyj4fal/ZMM/SC8vFq9wUS8Xa+8f2oQEVHN0C6zhilsNecNsAklQVYV9w1T SIBtt2A1/m+T3rC3GhQYXUZJbpzMLDnWovfzxsCEa4J5zimYFSGVz8xUn00K0+6Ttc3V uY/DhezBxBtVJK5b9VymUjufmcM6sYhBiIxDZ32y133miHKM3K91objVCkxpGHZiPQ1p mEe5pnYVn1AZ7hX7xVyB8eywHKrOd9dHa5Nl4l3dMobdVWIqxsrhHoVLHV+6c5j7hfpZ m7rw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i5-v6si13619328pgt.346.2018.06.18.16.37.52; Mon, 18 Jun 2018 16:38:05 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S937077AbeFRXgd (ORCPT + 99 others); Mon, 18 Jun 2018 19:36:33 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:38744 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935955AbeFRXgS (ORCPT ); Mon, 18 Jun 2018 19:36:18 -0400 Received: from akpm3.svl.corp.google.com (unknown [104.133.9.92]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 9060ACF8; Mon, 18 Jun 2018 23:36:17 +0000 (UTC) Date: Mon, 18 Jun 2018 16:36:16 -0700 From: Andrew Morton To: Pavel Tatashin Cc: Michal Hocko , Naoya Horiguchi , "linux-mm@kvack.org" , Oscar Salvador , Oscar Salvador , Steven Sistare , Daniel Jordan , Matthew Wilcox , "linux-kernel@vger.kernel.org" , "mingo@kernel.org" , "dan.j.williams@intel.com" , Huang Ying Subject: Re: [PATCH v3] x86/e820: put !E820_TYPE_RAM regions into memblock.reserved Message-Id: <20180618163616.52645949a8e4a0f73819fd62@linux-foundation.org> In-Reply-To: <20180615140000.44tht4f3ek3lh2u2@xakep.localdomain> References: <20180607100256.GA9129@hori1.linux.bs1.fc.nec.co.jp> <20180613054107.GA5329@hori1.linux.bs1.fc.nec.co.jp> <20180613090700.GG13364@dhcp22.suse.cz> <20180614051618.GB17860@hori1.linux.bs1.fc.nec.co.jp> <20180614053859.GA9863@techadventures.net> <20180614063454.GA32419@hori1.linux.bs1.fc.nec.co.jp> <20180614213033.GA19374@techadventures.net> <20180615010927.GC1196@hori1.linux.bs1.fc.nec.co.jp> <20180615072947.GB23273@hori1.linux.bs1.fc.nec.co.jp> <20180615084142.GE24039@dhcp22.suse.cz> <20180615140000.44tht4f3ek3lh2u2@xakep.localdomain> X-Mailer: Sylpheed 3.6.0 (GTK+ 2.24.31; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 15 Jun 2018 10:00:00 -0400 Pavel Tatashin wrote: > > > Signed-off-by: Naoya Horiguchi > > > Tested-by: Oscar Salvador > > > > OK, this makes sense to me. It is definitely much better than the > > original attempt. > > > > Unless I am missing something this should be correct > > Acked-by: Michal Hocko > > First of all thank you Naoya for finding and root causing this issue. > > So, with this fix we reserve any hole and !E820_TYPE_RAM or > !E820_TYPE_RESERVED_KERN in e820. I think, this will work because we > do pfn_valid() check in zero_resv_unavail(), so the ranges that do not have > backing struct pages will be skipped. But, I am worried on the performance > implications of when the holes of invalid memory are rather large. We would > have to loop through it in zero_resv_unavail() one pfn at a time. > > Therefore, we might also need to optimize zero_resv_unavail() a little like > this: > > 6407 if (!pfn_valid(ALIGN_DOWN(pfn, pageblock_nr_pages))) > 6408 continue; > > Add before "continue": > pfn = ALIGN_DOWN(pfn, pageblock_nr_pages) + pageblock_nr_pageas - 1. > At least, this way, we would skip a section of invalid memory at a time. > > For the patch above: > Reviewed-by: Pavel Tatashin > > But, I think the 2nd patch with the optimization above should go along this > this fix. So I expect this patch needs a cc:stable, which I'll add. The optimiation patch seems less important and I'd like to hold that off for 4.19-rc1?