Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932221Ab0KLS4U (ORCPT ); Fri, 12 Nov 2010 13:56:20 -0500 Received: from smtp-outbound-1.vmware.com ([65.115.85.69]:45094 "EHLO smtp-outbound-1.vmware.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932068Ab0KLS4T (ORCPT ); Fri, 12 Nov 2010 13:56:19 -0500 Subject: (mem hotplug, pcpu_alloc) BUG: sleeping function called from invalid context at kernel/mutex.c:94 From: Alok Kataria Reply-To: akataria@vmware.com To: linux-mm , LKML Cc: Tejun Heo , Andrew Morton , Petr Vandrovec Content-Type: text/plain Organization: VMware INC. Date: Fri, 12 Nov 2010 10:56:18 -0800 Message-Id: <1289588178.7486.15.camel@ank32.eng.vmware.com> Mime-Version: 1.0 X-Mailer: Evolution 2.12.3 (2.12.3-8.el5_2.3) Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3034 Lines: 68 Hi, We have seen following might_sleep warning while hot adding memory... [ 142.339267] BUG: sleeping function called from invalid context at kernel/mutex.c:94 [ 142.339276] in_atomic(): 0, irqs_disabled(): 1, pid: 4, name: migration/0 [ 142.339283] Pid: 4, comm: migration/0 Not tainted 2.6.35.6-45.fc14.x86_64 #1 [ 142.339288] Call Trace: [ 142.339305] [] __might_sleep+0xeb/0xf0 [ 142.339316] [] mutex_lock+0x24/0x50 [ 142.339326] [] pcpu_alloc+0x6d/0x7ee [ 142.339336] [] ? load_balance+0xbe/0x60e [ 142.339343] [] ? rt_se_boosted+0x21/0x2f [ 142.339349] [] ? dequeue_rt_stack+0x18b/0x1ed [ 142.339356] [] __alloc_percpu+0x10/0x12 [ 142.339362] [] setup_zone_pageset+0x38/0xbe [ 142.339373] [] ? build_zonelists_node.clone.58+0x79/0x8c [ 142.339384] [] __build_all_zonelists+0x419/0x46c [ 142.339395] [] ? cpu_stopper_thread+0xb2/0x198 [ 142.339401] [] stop_machine_cpu_stop+0x8e/0xc5 [ 142.339407] [] ? stop_machine_cpu_stop+0x0/0xc5 [ 142.339414] [] cpu_stopper_thread+0x108/0x198 [ 142.339420] [] ? schedule+0x5b2/0x5cc [ 142.339426] [] ? cpu_stopper_thread+0x0/0x198 [ 142.339434] [] kthread+0x7f/0x87 [ 142.339443] [] kernel_thread_helper+0x4/0x10 [ 142.339449] [] ? kthread+0x0/0x87 [ 142.339455] [] ? kernel_thread_helper+0x0/0x10 [ 142.340099] Built 5 zonelists in Node order, mobility grouping on. Total pages: 289456 [ 142.340108] Policy zone: Normal This warning was seen on the FC14 kernel, though looking at the current git, the problem seems to exist on mainline too. The problem is that pcpu_alloc expects that it is called from non-atomic context as a result it grabs the pcpu_alloc_mutex. In the memory-hotplug case though, we do end up calling pcpu_alloc from atomic context, while all cpus are stopped. void build_all_zonelists(void *data) { set_zonelist_order(); if (system_state == SYSTEM_BOOTING) { __build_all_zonelists(NULL); mminit_verify_zonelist(); cpuset_init_current_mems_allowed(); } else { /* we have to stop all cpus to guarantee there is no user of zonelist */ stop_machine(__build_all_zonelists, data, NULL); <========= /* cpuset refresh routine should be here */ } __build_all_zonelists eventually calls pcpu_alloc. I didn't dive through the history, so am not sure when was this regression introduced, but could have regressed with the new pcpu memory allocator. -- Alok -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/