From patchwork Tue Aug 2 12:08:31 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kautuk Consul X-Patchwork-Id: 1029312 Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p72C8sHA023884 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 2 Aug 2011 12:09:15 GMT Received: from canuck.infradead.org ([2001:4978:20e::1]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QoDm4-000567-5m; Tue, 02 Aug 2011 12:08:40 +0000 Received: from localhost ([127.0.0.1] helo=canuck.infradead.org) by canuck.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1QoDm3-0003Yk-NM; Tue, 02 Aug 2011 12:08:39 +0000 Received: from mail-vx0-f177.google.com ([209.85.220.177]) by canuck.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QoDlz-0003Y9-JJ for linux-arm-kernel@lists.infradead.org; Tue, 02 Aug 2011 12:08:37 +0000 Received: by vxh29 with SMTP id 29so5976688vxh.36 for ; Tue, 02 Aug 2011 05:08:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:cc:content-type; bh=bTyk3ju1yKYKeAXpwcJlQN3EPdA+s0LvxxL7igysA1c=; b=eLn/RA1ozC+889rH7EbY6I5JkcGdqVKUw17gquG/0wxaD2/cJezIX5VcLpH5WwTIPw bcKNrBl/ysnljWE+71fb2lhy4wTmyBT2o/JeHfCfmMu7AJe2JnSDUB7KEGScCa2OSUFm 1l0jLdAS6+xeDSKGj3lmuEZsu10IqOa0ntxfM= MIME-Version: 1.0 Received: by 10.52.117.101 with SMTP id kd5mr5267540vdb.364.1312286911167; Tue, 02 Aug 2011 05:08:31 -0700 (PDT) Received: by 10.52.166.225 with HTTP; Tue, 2 Aug 2011 05:08:31 -0700 (PDT) Date: Tue, 2 Aug 2011 17:38:31 +0530 Message-ID: Subject: [PATCH] ARM: sparsemem: Enable CONFIG_HOLES_IN_ZONE config option for SparseMem and HAS_HOLES_MEMORYMODEL for linux-3.0. From: Kautuk Consul To: Mel Gorman , Russell King X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20110802_080836_051380_4D2624AE X-CRM114-Status: GOOD ( 11.71 ) X-Spam-Score: -0.8 (/) X-Spam-Report: SpamAssassin version 3.3.1 on canuck.infradead.org summary: Content analysis details: (-0.8 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.220.177 listed in list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (consul.kautuk[at]gmail.com) -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Cc: linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Tue, 02 Aug 2011 12:09:15 +0000 (UTC) Hi, In the case where the total kernel memory is not aligned to the SECTION_SIZE_BITS I see a kernel crash. When I copy a huge file, then the kernel crashes at the following callstack: Backtrace: [] (__bug+0x0/0x30) from [] (move_freepages_block+0xd4/0x158) [] (move_freepages_block+0x0/0x158) from [] (__rmqueue+0x1dc/0x32c) r8:c0481120 r7:c048107c r6:00000003 r5:00000001 r4:c04f8200 r3:00000000 [] (__rmqueue+0x0/0x32c) from [] (get_page_from_freelist+0x12c/0x530) [] (get_page_from_freelist+0x0/0x530) from [] (__alloc_pages_nodemask+0xf0/0x544) [] (__alloc_pages_nodemask+0x0/0x544) from [] (cache_alloc_refill+0x2d0/0x654) [] (cache_alloc_refill+0x0/0x654) from [] (kmem_cache_alloc+0x58/0x9c) [] (kmem_cache_alloc+0x0/0x9c) from [] (radix_tree_preload+0x58/0xbc) r7:00006741 r6:000000d0 r5:c04a98a0 r4:ce986000 [] (radix_tree_preload+0x0/0xbc) from [] (add_to_page_cache_locked+0x20/0x1c4) r6:ce987d20 r5:ce346c1c r4:c04f8600 r3:000000d0 [] (add_to_page_cache_locked+0x0/0x1c4) from [] (add_to_page_cache_lru+0x4c/0x7c) r8:00000020 r7:ce7402a0 r6:ce987d20 r5:00000005 r4:c04f8600 r3:000000d0 [] (add_to_page_cache_lru+0x0/0x7c) from [] (mpage_readpages+0x7c/0x108) r5:00000005 r4:c04f8600 [] (mpage_readpages+0x0/0x108) from [] (fat_readpages+0x20/0x28) [] (fat_readpages+0x0/0x28) from [] (__do_page_cache_readahead+0x1c4/0x27c) [] (__do_page_cache_readahead+0x0/0x27c) from [] (ra_submit+0x2c/0x34) [] (ra_submit+0x0/0x34) from [] (ondemand_readahead+0x20c/0x21c) [] (ondemand_readahead+0x0/0x21c) from [] (page_cache_async_readahead+0xa4/0xd8) [] (page_cache_async_readahead+0x0/0xd8) from [] (generic_file_aio_read+0x360/0x7f4) r8:00000000 r7:ce346c1c r6:ce88dba0 r5:0000671c r4:c04f9640 [] (generic_file_aio_read+0x0/0x7f4) from [] (do_sync_read+0xa0/0xd8) [] (do_sync_read+0x0/0xd8) from [] (vfs_read+0xb8/0x154) r6:bed53650 r5:ce88dba0 r4:00001000 [] (vfs_read+0x0/0x154) from [] (sys_read+0x44/0x70) r8:0671c000 r7:00000003 r6:00001000 r5:bed53650 r4:ce88dba0 [] (sys_read+0x0/0x70) from [] (ret_fast_syscall+0x0/0x30) r9:ce986000 r8:c0023128 r6:bed53650 r5:00001000 r4:0013a4e0 Code: e59f0010 e1a01003 eb0d0852 e3a03000 (e5833000) The reason for this is that the CONFIG_HOLES_IN_ZONE configuration option is not automatically enabled when SPARSEMEM or ARCH_HAS_HOLES_MEMORYMODEL are enabled. Due to this, the pfn_valid_within() macro always returns 1 due to which the BUG_ON is encountered. This patch enables the CONFIG_HOLES_IN_ZONE config option if either ARCH_HAS_HOLES_MEMORYMODEL or SPARSEMEM is enabled. Although I tested this on an older kernel, i.e., 2.6.35.13, I see that this option has not been enabled as yet in linux-3.0 and this appears to be a logically correct change anyways with respect to pfn_valid_within() functionality. Cc: Russell King Cc: Mel Gorman Signed-off-by: Kautuk Consul --- Thanks, Kautuk. --- a/arch/arm/Kconfig 2011-08-02 16:51:32.109207996 +0530 +++ b/arch/arm/Kconfig 2011-08-02 16:56:19.036207994 +0530 @@ -1508,6 +1508,9 @@ config ARCH_SELECT_MEMORY_MODEL config HAVE_ARCH_PFN_VALID def_bool ARCH_HAS_HOLES_MEMORYMODEL || !SPARSEMEM +config HOLES_IN_ZONE + def_bool ARCH_HAS_HOLES_MEMORYMODEL || SPARSEMEM + config HIGHMEM bool "High Memory Support" depends on MMU