Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp710942pxu; Thu, 3 Dec 2020 10:38:18 -0800 (PST) X-Google-Smtp-Source: ABdhPJyu11ARoCtijaCg98MGVg8j5HjBBwb4Kn9Sdodug0Ty05S35u2iuMzKp1v5cMMax52yeUaP X-Received: by 2002:a50:e0c9:: with SMTP id j9mr4112331edl.380.1607020698164; Thu, 03 Dec 2020 10:38:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607020698; cv=none; d=google.com; s=arc-20160816; b=L41TvLdzfZlTfSl1V+/6FhtK4zJhUAQ3QJnDeRPby55s1x5tm1KUqDpsCd5nhAvytQ E5iAXAt2UO5o4N3fe7F0div7T60PoyLfzAskxUwwmC7PHPwJJqV0KJUUzwHfZFHIrDAm 1QMUC0YuRZ4CgkcsmZuc/pDmXaFc+/r2P5WJZpAGvmDbRC6bY/dcaXN1LtOt47CwyFio 3t6E36JYNo9xtmf3rklPLYkfmUYMA+9ceomk/fptIfwzxPEEgEAAqR0lDnMDkDIXPYLo cAGpN0E/Uw2K77TCMtsBVzv2nbLRVax0N9Hrj6hcdKWGXtJxkAgi9VxW+g+iCxCJjbPZ DXOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=QJUw/pr4nf2NM2FpsqPAixF+QB/rQYSePgBJ4oHqJXc=; b=XmJMV6u+rqquAyyZGN6RXCS2f7x69hJ/opwoG0PwrTgEEiN0TE16nlAbkPZXXrk9I2 jR+C+lxPCo0IEsQtz4oolsatJYwp9dnwpKUxOTt9wV/WMFO0UtlDWENS6ag8qUkKQiue zZH4Hjx+uuL+ve/EWyLN8a8+eaRyY33+r320b0rZ8UjYDEmN7uM+XH07ejJH6hAqVjE7 6uCZDe1J4hJripHjfmYLb1rOokf+GjOsFBx+hMQR/dfpl1uSkFinxmE4XIKO54f1Rs8N VLEdH2G3aKqmDy5+m/vlC90L18V06DdYn7MXOgkpbTJTb/0qY5Bm7gfxemPIOMHBDLUZ ZnHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=S0ZeWodF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p62si1422232edd.213.2020.12.03.10.37.55; Thu, 03 Dec 2020 10:38:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=S0ZeWodF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726012AbgLCSg3 (ORCPT + 99 others); Thu, 3 Dec 2020 13:36:29 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:56820 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726222AbgLCSg2 (ORCPT ); Thu, 3 Dec 2020 13:36:28 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607020502; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=QJUw/pr4nf2NM2FpsqPAixF+QB/rQYSePgBJ4oHqJXc=; b=S0ZeWodFgwP5KKM7XcWYRUySeXJtERAQrbG0FSLeO/aTtnWbPGJWI0Zs6HT2qgC5Q/mZA9 e32j0ce0J5pq2Fd9CXhCkd0JZBnsiRuSMJtFM4DVCgmd70Mr9DYw3Cy6Wz/ZPpOz4TQ+VT P3QMeL7zqIEWOzFe/rMDHxRXGoMclf0= 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-275-JJKstRQZO3ivnDBBixqMBA-1; Thu, 03 Dec 2020 13:34:58 -0500 X-MC-Unique: JJKstRQZO3ivnDBBixqMBA-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5B874AFA81; Thu, 3 Dec 2020 18:34:56 +0000 (UTC) Received: from mail (ovpn-112-118.rdu2.redhat.com [10.10.112.118]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A33395D6BA; Thu, 3 Dec 2020 18:34:52 +0000 (UTC) Date: Thu, 3 Dec 2020 13:34:52 -0500 From: Andrea Arcangeli To: Mike Rapoport Cc: Andrew Morton , linux-mm@kvack.org, Baoquan He , David Hildenbrand , Mel Gorman , Michal Hocko , Mike Rapoport , Qian Cai , Vlastimil Babka , linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm: refactor initialization of stuct page for holes in memory layout Message-ID: References: <20201201181502.2340-1-rppt@kernel.org> <20201202154736.5799e01b4c27a75b98e863fc@linux-foundation.org> <20201203062549.GG751215@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201203062549.GG751215@kernel.org> User-Agent: Mutt/2.0.2 (2020-11-20) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, On Thu, Dec 03, 2020 at 08:25:49AM +0200, Mike Rapoport wrote: > On Wed, Dec 02, 2020 at 03:47:36PM -0800, Andrew Morton wrote: > > On Tue, 1 Dec 2020 20:15:02 +0200 Mike Rapoport wrote: > > > > > From: Mike Rapoport > > > > > > There could be struct pages that are not backed by actual physical memory. > > > This can happen when the actual memory bank is not a multiple of > > > SECTION_SIZE or when an architecture does not register memory holes > > > reserved by the firmware as memblock.memory. > > > > > > Such pages are currently initialized using init_unavailable_mem() function > > > that iterated through PFNs in holes in memblock.memory and if there is a > > > struct page corresponding to a PFN, the fields if this page are set to > > > default values and it is marked as Reserved. > > > > > > init_unavailable_mem() does not take into account zone and node the page > > > belongs to and sets both zone and node links in struct page to zero. > > > > > > On a system that has firmware reserved holes in a zone above ZONE_DMA, for > > > instance in a configuration below: > > > > > > # grep -A1 E820 /proc/iomem > > > 7a17b000-7a216fff : Unknown E820 type > > > 7a217000-7bffffff : System RAM > > > > > > unset zone link in struct page will trigger > > > > > > VM_BUG_ON_PAGE(!zone_spans_pfn(page_zone(page), pfn), page); > > > > That sounds pretty serious. My understanding is that with DEBUG_VM=n the invariant that broke won't cause trouble, but Fedora is helping the upstream testing by keeping DEBUG_VM=y and it's shipping with v5.8 and v5.9 for a while, so it could very well crash those kernels if they've that type 20 thing in the e820 map. > > > > > because there are pages in both ZONE_DMA32 and ZONE_DMA (unset zone link in > > > struct page) in the same pageblock. > > > > > > Interleave initialization of pages that correspond to holes with the > > > initialization of memory map, so that zone and node information will be > > > properly set on such pages. > > > > > > > Should this be backported to -stable? If so, do we have a suitable Fixes:? > > Sorry, I forgot to add > > Fixes: 73a6e474cb37 ("mm: memmap_init: iterate over memblock regions rather that check each PFN") I've been wondering already why I'm the only one getting a crash every two weeks. Ince it crashed in MADV_HUGEPAGE of qemu that would definitely happened even with Fedora despite the THP enabled = madvise, and it hung qemu for good so it was noticeable since it was in direction compaction. Other times it was in kcompactd so it just killed the kernel thread and it was only noticeable in the kernel logs and probably it doesn't happen that frequently unless THP enabled = always, although it could still happen, compaction isn't used just for THP. Thanks, Andrea