From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751793AbdJIEKF (ORCPT ); Mon, 9 Oct 2017 00:10:05 -0400 Received: from mail-wm0-f41.google.com ([74.125.82.41]:56728 "EHLO mail-wm0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751283AbdJIEKE (ORCPT ); Mon, 9 Oct 2017 00:10:04 -0400 X-Google-Smtp-Source: AOwi7QA3xqYwlueOtJk22jivET3UE1FIGcj8XG293r8+uGG/yRdks7TWJjHATtQM0EmURwiDsFKyQw== Date: Mon, 9 Oct 2017 07:10:01 +0300 From: "Kirill A. Shutemov" To: Jia-Ju Bai Cc: akpm@linux-foundation.org, mhocko@suse.com, mingo@kernel.org, catalin.marinas@arm.com, labbott@redhat.com, thgarnie@google.com, kirill.shutemov@linux.intel.com, aryabinin@virtuozzo.com, ard.biesheuvel@linaro.org, zijun_hu@htc.com, linux-mm@kvack.org, Linux Kernel Mailing List Subject: Re: [BUG] mm/vmalloc: ___might_sleep is called under a spinlock in __purge_vmap_area_lazy Message-ID: <20171009041001.p47yc6r7f3borhba@node.shutemov.name> References: <70f9850a-b24c-8595-8a22-9b47e96d6338@163.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <70f9850a-b24c-8595-8a22-9b47e96d6338@163.com> User-Agent: NeoMutt/20170609 (1.8.3) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Oct 09, 2017 at 12:00:33PM +0800, Jia-Ju Bai wrote: > The ___might_sleep is called under a spinlock, and the function call graph > is: > __purge_vmap_area_lazy (acquire the spinlock) > cond_resched_lock > ___might_sleep > > In this situation, ___might_sleep may prints error log message because a > spinlock is held. > A possible fix is to remove ___might_sleep in cond_resched_lock. > > This bug is found by my static analysis tool and my code review. This analysis doesn't makes sense. The point of cond_resched_lock() is that it drops the lock, if resched is required. ___might_sleep() is called with preempt_offset equal to PREEMPT_LOCK_OFFSET, so it won't report error if it's the only lock we hold. -- Kirill A. Shutemov