Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp1805297ybg; Sat, 19 Oct 2019 02:54:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqwd/Lcoui1zvmYXW0/Y5V/JZ7/z4e/sbvPlnVa8bdWXvT4446ANz7iF2yaI5zw8nnkRv0aO X-Received: by 2002:a17:906:5502:: with SMTP id r2mr13133815ejp.3.1571478849301; Sat, 19 Oct 2019 02:54:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571478849; cv=none; d=google.com; s=arc-20160816; b=Qs+5Ukrb3zCAqnzaZz6HTxZvPlpEIM1HNwNjmGeeSWZn+GOhTqqUf2U1ed2M0HY8Mr h7goar1LSKXEdVltZ/VA7+Dy5Z/vzC1PxWa6lriwEAJs2z9VxbKIzOnbiwBrgjEb/wuk 5DdNoFFhU3eaziodm3mA7heyaRRqXHjXDr1JOIypmJOXybWpcLSx/feVhOGQK4f3QYkw opJ/5zPzavspl4FWwFQsOWFku9E42b+5+ICa9B4U3+0dRbLHEsfhlPo5cQhJWwo/lvWU ADlu1STS4JUO/4JAyVkSy/v0Lm96N4q6vTFhKpPjWdZtxLfKbxjf/A6UsQjScLkgBuio SP0w== 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 :dkim-signature; bh=8TxBkPkDpA/31kSLZjdFoPyRuflSMFG5DfYUfJ8j9C8=; b=osGVc1Xn7KVCrAjNq/zIMJ3RaOuT9yiRsxweh/tTSE4bcy++GpnO8JfCtoXr6U4w3l lpdOpPSkGMTa1SGCzijVeG+HlvI19wqv6aKp3ZZakIpDhTX9ZyHhX526SjFHLbUrbvZV l4fx/taXKUR/ICBmAaxT2NLkx9PeIC7iPpk50Vh5emWkXwTh/kc1XXLNsOJHopyCL2gQ XgX6D6o/frdy44+a828M87M182zaAQ4VFZkqp+IhdK70n08AnxdJXgKCSK0FH9wXQwkF M8spbqKcOrMM4nwBH9zGSEl4RXeFuycJOI3xn4OaPk5EXliDWv0y8Ewtt7eDQX/9DfAi WN2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=gXGHd6V2; 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 t18si4847107ejx.135.2019.10.19.02.53.45; Sat, 19 Oct 2019 02:54:09 -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; dkim=pass header.i=@kernel.org header.s=default header.b=gXGHd6V2; 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 S1726835AbfJSCFd (ORCPT + 99 others); Fri, 18 Oct 2019 22:05:33 -0400 Received: from mail.kernel.org ([198.145.29.99]:50890 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726773AbfJSCFc (ORCPT ); Fri, 18 Oct 2019 22:05:32 -0400 Received: from localhost.localdomain (c-73-231-172-41.hsd1.ca.comcast.net [73.231.172.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A0DB3222C5; Sat, 19 Oct 2019 02:05:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1571450731; bh=8nWcylZqHzMVIk7uB0sGYSXsSv+KJhSMGMXr6+VKXUs=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=gXGHd6V2r2kqj8KD8t2ZwllUYgynkGbAtBTFJlcJx37APcKsa7K2PPhpLUNTUdEMO 3T35YRTiEbpPqCNtPSZ2njwBHxg2xZ27d5WA1vMWuXVfQfi3hDA+RO5kT/Ri/EIrce BUbTmyhIrWG7ofHc0GVI0VTSsY2d1MCRV43+vknw= Date: Fri, 18 Oct 2019 19:05:31 -0700 From: Andrew Morton To: David Hildenbrand Cc: Naoya Horiguchi , "linux-kernel@vger.kernel.org" , "linux-mm@kvack.org" , Michal Hocko Subject: Re: [PATCH v2 2/2] mm/memory-failure.c: Don't access uninitialized memmaps in memory_failure() Message-Id: <20191018190531.975b70fabdce5f7e5d6b27df@linux-foundation.org> In-Reply-To: <134d4f03-a40a-fe62-fb93-53d209a91d2e@redhat.com> References: <20191009142435.3975-1-david@redhat.com> <20191009142435.3975-3-david@redhat.com> <20191010002619.GB3585@hori.linux.bs1.fc.nec.co.jp> <134d4f03-a40a-fe62-fb93-53d209a91d2e@redhat.com> X-Mailer: Sylpheed 3.5.1 (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 Thu, 10 Oct 2019 09:17:42 +0200 David Hildenbrand wrote: > >> - pgmap = get_dev_pagemap(pfn, NULL); > >> - if (pgmap) > >> - return memory_failure_dev_pagemap(pfn, flags, pgmap); > >> - > >> - p = pfn_to_page(pfn); > > > > This change seems to assume that memory_failure_dev_pagemap() is never > > called for online pages. Is it an intended behavior? > > Or the concept "online pages" is not applicable to zone device pages? > > Yes, that's the real culprit. ZONE_DEVICE/devmem pages are never online > (SECTION_IS_ONLINE). The terminology "online" only applies to pages that > were given to the buddy. And as we support sup-section hotadd for > devmem, we cannot easily make use of the section flag it. I already > proposed somewhere to convert SECTION_IS_ONLINE to a subsection bitmap > and call it something like pfn_active(). > > pfn_online() would then be "pfn_active() && zone != ZONE_DEVICE". And we > could use pfn_active() everywhere to test for initialized memmaps (well, > besides some special cases like device reserved memory that does not > span full sub-sections). Until now, nobody volunteered and I have other > things to do. Is it worth a code comment or two to make this clearer?