From patchwork Wed Dec 11 16:31:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 11285697 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1A27F109A for ; Wed, 11 Dec 2019 16:32:15 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D181B2077B for ; Wed, 11 Dec 2019 16:32:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="jWJNbYgo" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D181B2077B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 045236B32DC; Wed, 11 Dec 2019 11:32:14 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 01CD76B32DD; Wed, 11 Dec 2019 11:32:13 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E9B3C6B32DE; Wed, 11 Dec 2019 11:32:13 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0149.hostedemail.com [216.40.44.149]) by kanga.kvack.org (Postfix) with ESMTP id D3F4F6B32DC for ; Wed, 11 Dec 2019 11:32:13 -0500 (EST) Received: from smtpin14.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with SMTP id 87F3A181AEF1A for ; Wed, 11 Dec 2019 16:32:13 +0000 (UTC) X-FDA: 76253402946.14.rifle46_87cafb3738260 X-Spam-Summary: 1,0,0,,d41d8cd98f00b204,david@redhat.com,:linux-kernel@vger.kernel.org::david@redhat.com:adobriyan@gmail.com:akpm@linux-foundation.org:bob.picco@oracle.com:daniel.m.jordan@oracle.com:dan.j.williams@intel.com:mhocko@kernel.org:mhocko@suse.com:n-horiguchi@ah.jp.nec.com:osalvador@suse.de:pasha.tatashin@oracle.com:sfr@canb.auug.org.au:steven.sistare@oracle.com,RULES_HIT:30054,0,RBL:207.211.31.81:@redhat.com:.lbl8.mailshell.net-62.18.0.100 66.10.201.10,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:24,LUA_SUMMARY:none X-HE-Tag: rifle46_87cafb3738260 X-Filterd-Recvd-Size: 3500 Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by imf45.hostedemail.com (Postfix) with ESMTP for ; Wed, 11 Dec 2019 16:32:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576081932; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=LKFqnBlvG1fW2JXIJg+dQL5IlchdA2nn0WN6YjbROus=; b=jWJNbYgotK2tw5kv7AU7hZdjoEz9oBCCR+9UVzPD5d+CnloIyIzlWqN6z+vsG2XqsRlJAv p13dZKIdwGS9T+YnEtTauvX368u7vLld4coElT19v6yCC3zBitx4cNHw+veRg5EuQcjjhQ LhNlwPRAWz46xFEj72I8pcJe/vowuo4= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-83-pAFiM52NPEutsb_TVfBPDg-1; Wed, 11 Dec 2019 11:32:11 -0500 X-MC-Unique: pAFiM52NPEutsb_TVfBPDg-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3A74AB0923; Wed, 11 Dec 2019 16:32:08 +0000 (UTC) Received: from t480s.redhat.com (ovpn-117-148.ams2.redhat.com [10.36.117.148]) by smtp.corp.redhat.com (Postfix) with ESMTP id 62A37605FF; Wed, 11 Dec 2019 16:32:02 +0000 (UTC) From: David Hildenbrand To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, David Hildenbrand , Alexey Dobriyan , Andrew Morton , Bob Picco , Daniel Jordan , Dan Williams , Michal Hocko , Michal Hocko , Naoya Horiguchi , Oscar Salvador , Pavel Tatashin , Stephen Rothwell , Steven Sistare Subject: [PATCH v2 0/3] mm: fix max_pfn not falling on section boundary Date: Wed, 11 Dec 2019 17:31:58 +0100 Message-Id: <20191211163201.17179-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Playing with different memory sizes for a x86-64 guest, I discovered that some memmaps (highest section if max_mem does not fall on the section boundary) are marked as being valid and online, but contain garbage. We have to properly initialize these memmaps. Looking at /proc/kpageflags and friends, I found some more issues, partially related to this. v1 -> v2: - "mm: fix uninitialized memmaps on a partially populated last section" -- Refine patch description (esp. how to reproduce), add tested-by - "fs/proc/page.c: allow inspection of last section and fix end detection" -- Make it compile for !CONFIG_SPARSE and add a comment to the new helper function David Hildenbrand (3): mm: fix uninitialized memmaps on a partially populated last section fs/proc/page.c: allow inspection of last section and fix end detection mm: initialize memmap of unavailable memory directly fs/proc/page.c | 30 +++++++++++++++++++++++++++--- include/linux/mm.h | 6 ------ mm/page_alloc.c | 43 ++++++++++++++++++++++++++++++++----------- 3 files changed, 59 insertions(+), 20 deletions(-)