From patchwork Thu Aug 30 15:05:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Morse X-Patchwork-Id: 10581975 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 52D0314BD for ; Thu, 30 Aug 2018 15:05:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 433222793B for ; Thu, 30 Aug 2018 15:05:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 367EC2C01E; Thu, 30 Aug 2018 15:05:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0111D286FE for ; Thu, 30 Aug 2018 15:05:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CF0566B5274; Thu, 30 Aug 2018 11:05:47 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id C9FA16B5275; Thu, 30 Aug 2018 11:05:47 -0400 (EDT) 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 BB5666B5276; Thu, 30 Aug 2018 11:05:47 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-oi0-f71.google.com (mail-oi0-f71.google.com [209.85.218.71]) by kanga.kvack.org (Postfix) with ESMTP id 944866B5274 for ; Thu, 30 Aug 2018 11:05:47 -0400 (EDT) Received: by mail-oi0-f71.google.com with SMTP id w185-v6so7734429oig.19 for ; Thu, 30 Aug 2018 08:05:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id; bh=G+grvfK1wtITT5A10sR3+vz2QUh+r0xYF0LN/vhjNeM=; b=RniC0LjkIYaHc85DSGsN9T8b09ZVVK5ykcjK4jOjyy3v3Jb5jlubaw4600ZVp2WDV+ VIeOx4rsmkE+IDlJHgQBzgoF1XZs4J3StjQdlGd9NaBEadZEfv1kGt1LieBNeIttuiYJ NNOGK+jtirTL9ndzfuTCW3XYUZ6w6czrK1HZlsb5oqWkWgDhriuCrcGjmmTjBr6B2rM9 InU7+lGbh/jk7HQ32mTTWfqw7enwzvzW1Efa2DIIFIBt0zFt7qN8tP+TQ9hVXF9J1dgX l7i0fLGa+uVIGOB8vL6DjxQZSo5Gx1j6ne2d8H/qmI5/4laNnXKw7ZNlcNOLCKNs0AK/ GuRg== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of james.morse@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=james.morse@arm.com X-Gm-Message-State: APzg51AtJ5n77CQ0uQviPGW0YFFQ7EwkYXZQuXTWI6Yhc+Cq92WdySdS Q8zEMSWX6jNAfFQH9770crTLAP1WHYmWXjpyFtXybmdZSmDq4HJPFanBf3tZJpszegH5OZdt5lL eBFHnGFFSZm3MMI+nMsPzKVOOmFjtFXQGoay0BNr6SO1T3jrISru0Spu5VJx67DjfmQ== X-Received: by 2002:aca:b154:: with SMTP id a81-v6mr3145571oif.34.1535641547215; Thu, 30 Aug 2018 08:05:47 -0700 (PDT) X-Google-Smtp-Source: ANB0VdadEMEQwDBdNoH3msD6vhPEwCZU1RBqkHc/Qua6HjYFpX0p69VArcTI6sGezpbX/3OHOUA4 X-Received: by 2002:aca:b154:: with SMTP id a81-v6mr3145476oif.34.1535641546092; Thu, 30 Aug 2018 08:05:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535641546; cv=none; d=google.com; s=arc-20160816; b=KZCBXzSu8vLIDAEr/afsq6MSHukrW+Q9im9WdZJ/2IOazKuivevCDsvU/0dWmqo5rj HiCT05Ww/f/6Z1lC15q/4CZF8Yu2/S9NwfDZDzb+/CYY8Z80FmCS18zYgmd9kInuBouY I4DAHFKIna7IX6f5yxu9veMc5IJNJL5jOodFpLyYAS845Do8hlq/jW3vHjNU62/sV/uD OcNvk1C4+sIeqULYgkv44lj8FQbtDLLNexWkvUwYxyPjikx5pZ7BX6GHQANx4Ojgyocl L9ObOGX+f9iLc0uClb379PU7nGY+owcZet5vduic7RVCA0YeCvTuAuLpkpFQ969gq1BV 3zSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:cc:to:from:arc-authentication-results; bh=G+grvfK1wtITT5A10sR3+vz2QUh+r0xYF0LN/vhjNeM=; b=jQzmH+3CXYE9clrGVXF0BiP5NTg04BqBADX25ZMvcSEJwV2+UYcTznm0rIdDVMMl+8 0qPTYDJMB/IWf0hwQ4ZEUQhpOWulB0GROIfpzKIQA85IbDTos9+XY35NivjrrOiyEGFc purv6pJBzhOS8S6Xcfxa/rjPyVQQFWpkGi1mv5vK6kxe/VLAACsA/qtNHjB1wMUMfjRr 7JNvryUbRPmfg3g0APc84ESuBFP4PAahXkpEpt6CQDCmNI8gTg/Fo+868rqHquWHIEpP FmpBiyemig+Qh2xiG62JJOCH/I6YezrpSpm7dD+j1fmBDOtdSFTj+pdB3AMXe8J1+bSb aEjg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of james.morse@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=james.morse@arm.com Received: from foss.arm.com (foss.arm.com. [217.140.101.70]) by mx.google.com with ESMTP id i7-v6si5066299oib.262.2018.08.30.08.05.45 for ; Thu, 30 Aug 2018 08:05:45 -0700 (PDT) Received-SPF: pass (google.com: domain of james.morse@arm.com designates 217.140.101.70 as permitted sender) client-ip=217.140.101.70; Authentication-Results: mx.google.com; spf=pass (google.com: domain of james.morse@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=james.morse@arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 0987B18A; Thu, 30 Aug 2018 08:05:45 -0700 (PDT) Received: from melchizedek.Emea.Arm.com (melchizedek.emea.arm.com [10.4.12.81]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 615753F5BC; Thu, 30 Aug 2018 08:05:43 -0700 (PDT) From: James Morse To: linux-arm-kernel@lists.infradead.org Cc: linux-mm@kvack.org, Michal Hocko , Pavel Tatashin , Mikulas Patocka , Catalin Marinas , Will Deacon , James Morse , Ard Biesheuvel Subject: [PATCH] arm64: mm: always enable CONFIG_HOLES_IN_ZONE Date: Thu, 30 Aug 2018 16:05:32 +0100 Message-Id: <20180830150532.22745-1-james.morse@arm.com> X-Mailer: git-send-email 2.18.0 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: X-Virus-Scanned: ClamAV using ClamSMTP Commit 6d526ee26ccd ("arm64: mm: enable CONFIG_HOLES_IN_ZONE for NUMA") only enabled HOLES_IN_ZONE for NUMA systems because the NUMA code was choking on the missing zone for nomap pages. This problem doesn't just apply to NUMA systems. If the architecture doesn't set HAVE_ARCH_PFN_VALID, pfn_valid() will return true if the pfn is part of a valid sparsemem section. When working with multiple pages, the mm code uses pfn_valid_within() to test each page it uses within the sparsemem section is valid. On most systems memory comes in MAX_ORDER_NR_PAGES chunks which all have valid/initialised struct pages. In this case pfn_valid_within() is optimised out. Systems where this isn't true (e.g. due to nomap) should set HOLES_IN_ZONE and provide HAVE_ARCH_PFN_VALID so that mm tests each page as it works with it. Currently non-NUMA arm64 systems can't enable HOLES_IN_ZONE, leading to VM_BUG_ON(): | page:fffffdff802e1780 is uninitialized and poisoned | raw: ffffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffff | raw: ffffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffff | page dumped because: VM_BUG_ON_PAGE(PagePoisoned(p)) | ------------[ cut here ]------------ | kernel BUG at include/linux/mm.h:978! | Internal error: Oops - BUG: 0 [#1] PREEMPT SMP [...] | CPU: 1 PID: 25236 Comm: dd Not tainted 4.18.0 #7 | Hardware name: QEMU KVM Virtual Machine, BIOS 0.0.0 02/06/2015 | pstate: 40000085 (nZcv daIf -PAN -UAO) | pc : move_freepages_block+0x144/0x248 | lr : move_freepages_block+0x144/0x248 | sp : fffffe0071177680 [...] | Process dd (pid: 25236, stack limit = 0x0000000094cc07fb) | Call trace: | move_freepages_block+0x144/0x248 | steal_suitable_fallback+0x100/0x16c | get_page_from_freelist+0x440/0xb20 | __alloc_pages_nodemask+0xe8/0x838 | new_slab+0xd4/0x418 | ___slab_alloc.constprop.27+0x380/0x4a8 | __slab_alloc.isra.21.constprop.26+0x24/0x34 | kmem_cache_alloc+0xa8/0x180 | alloc_buffer_head+0x1c/0x90 | alloc_page_buffers+0x68/0xb0 | create_empty_buffers+0x20/0x1ec | create_page_buffers+0xb0/0xf0 | __block_write_begin_int+0xc4/0x564 | __block_write_begin+0x10/0x18 | block_write_begin+0x48/0xd0 | blkdev_write_begin+0x28/0x30 | generic_perform_write+0x98/0x16c | __generic_file_write_iter+0x138/0x168 | blkdev_write_iter+0x80/0xf0 | __vfs_write+0xe4/0x10c | vfs_write+0xb4/0x168 | ksys_write+0x44/0x88 | sys_write+0xc/0x14 | el0_svc_naked+0x30/0x34 | Code: aa1303e0 90001a01 91296421 94008902 (d4210000) | ---[ end trace 1601ba47f6e883fe ]--- Remove the NUMA dependency. Reported-by: Mikulas Patocka Link: https://www.spinics.net/lists/arm-kernel/msg671851.html Fixes: 6d526ee26ccd ("arm64: mm: enable CONFIG_HOLES_IN_ZONE for NUMA") CC: Ard Biesheuvel Signed-off-by: James Morse Reviewed-by: Pavel Tatashin Tested-by: Mikulas Patocka Acked-by: Michal Hocko --- arch/arm64/Kconfig | 1 - 1 file changed, 1 deletion(-) diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 29e75b47becd..1b1a0e95c751 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -763,7 +763,6 @@ config NEED_PER_CPU_EMBED_FIRST_CHUNK config HOLES_IN_ZONE def_bool y - depends on NUMA source kernel/Kconfig.hz