mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-11-01 17:08:10 +00:00
8a8c35fadf
Beginning at commit d52d3997f8
("ipv6: Create percpu rt6_info"), the
following INFO splat is logged:
===============================
[ INFO: suspicious RCU usage. ]
4.1.0-rc7-next-20150612 #1 Not tainted
-------------------------------
kernel/sched/core.c:7318 Illegal context switch in RCU-bh read-side critical section!
other info that might help us debug this:
rcu_scheduler_active = 1, debug_locks = 0
3 locks held by systemd/1:
#0: (rtnl_mutex){+.+.+.}, at: [<ffffffff815f0c8f>] rtnetlink_rcv+0x1f/0x40
#1: (rcu_read_lock_bh){......}, at: [<ffffffff816a34e2>] ipv6_add_addr+0x62/0x540
#2: (addrconf_hash_lock){+...+.}, at: [<ffffffff816a3604>] ipv6_add_addr+0x184/0x540
stack backtrace:
CPU: 0 PID: 1 Comm: systemd Not tainted 4.1.0-rc7-next-20150612 #1
Hardware name: TOSHIBA TECRA A50-A/TECRA A50-A, BIOS Version 4.20 04/17/2014
Call Trace:
dump_stack+0x4c/0x6e
lockdep_rcu_suspicious+0xe7/0x120
___might_sleep+0x1d5/0x1f0
__might_sleep+0x4d/0x90
kmem_cache_alloc+0x47/0x250
create_object+0x39/0x2e0
kmemleak_alloc_percpu+0x61/0xe0
pcpu_alloc+0x370/0x630
Additional backtrace lines are truncated. In addition, the above splat
is followed by several "BUG: sleeping function called from invalid
context at mm/slub.c:1268" outputs. As suggested by Martin KaFai Lau,
these are the clue to the fix. Routine kmemleak_alloc_percpu() always
uses GFP_KERNEL for its allocations, whereas it should follow the gfp
from its callers.
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Reviewed-by: Kamalesh Babulal <kamalesh@linux.vnet.ibm.com>
Acked-by: Martin KaFai Lau <kafai@fb.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Martin KaFai Lau <kafai@fb.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Tejun Heo <tj@kernel.org>
Cc: Christoph Lameter <cl@linux-foundation.org>
Cc: <stable@vger.kernel.org> [3.18+]
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
112 lines
3 KiB
C
112 lines
3 KiB
C
/*
|
|
* include/linux/kmemleak.h
|
|
*
|
|
* Copyright (C) 2008 ARM Limited
|
|
* Written by Catalin Marinas <catalin.marinas@arm.com>
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
* published by the Free Software Foundation.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program; if not, write to the Free Software
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
*/
|
|
|
|
#ifndef __KMEMLEAK_H
|
|
#define __KMEMLEAK_H
|
|
|
|
#include <linux/slab.h>
|
|
|
|
#ifdef CONFIG_DEBUG_KMEMLEAK
|
|
|
|
extern void kmemleak_init(void) __ref;
|
|
extern void kmemleak_alloc(const void *ptr, size_t size, int min_count,
|
|
gfp_t gfp) __ref;
|
|
extern void kmemleak_alloc_percpu(const void __percpu *ptr, size_t size,
|
|
gfp_t gfp) __ref;
|
|
extern void kmemleak_free(const void *ptr) __ref;
|
|
extern void kmemleak_free_part(const void *ptr, size_t size) __ref;
|
|
extern void kmemleak_free_percpu(const void __percpu *ptr) __ref;
|
|
extern void kmemleak_update_trace(const void *ptr) __ref;
|
|
extern void kmemleak_not_leak(const void *ptr) __ref;
|
|
extern void kmemleak_ignore(const void *ptr) __ref;
|
|
extern void kmemleak_scan_area(const void *ptr, size_t size, gfp_t gfp) __ref;
|
|
extern void kmemleak_no_scan(const void *ptr) __ref;
|
|
|
|
static inline void kmemleak_alloc_recursive(const void *ptr, size_t size,
|
|
int min_count, unsigned long flags,
|
|
gfp_t gfp)
|
|
{
|
|
if (!(flags & SLAB_NOLEAKTRACE))
|
|
kmemleak_alloc(ptr, size, min_count, gfp);
|
|
}
|
|
|
|
static inline void kmemleak_free_recursive(const void *ptr, unsigned long flags)
|
|
{
|
|
if (!(flags & SLAB_NOLEAKTRACE))
|
|
kmemleak_free(ptr);
|
|
}
|
|
|
|
static inline void kmemleak_erase(void **ptr)
|
|
{
|
|
*ptr = NULL;
|
|
}
|
|
|
|
#else
|
|
|
|
static inline void kmemleak_init(void)
|
|
{
|
|
}
|
|
static inline void kmemleak_alloc(const void *ptr, size_t size, int min_count,
|
|
gfp_t gfp)
|
|
{
|
|
}
|
|
static inline void kmemleak_alloc_recursive(const void *ptr, size_t size,
|
|
int min_count, unsigned long flags,
|
|
gfp_t gfp)
|
|
{
|
|
}
|
|
static inline void kmemleak_alloc_percpu(const void __percpu *ptr, size_t size,
|
|
gfp_t gfp)
|
|
{
|
|
}
|
|
static inline void kmemleak_free(const void *ptr)
|
|
{
|
|
}
|
|
static inline void kmemleak_free_part(const void *ptr, size_t size)
|
|
{
|
|
}
|
|
static inline void kmemleak_free_recursive(const void *ptr, unsigned long flags)
|
|
{
|
|
}
|
|
static inline void kmemleak_free_percpu(const void __percpu *ptr)
|
|
{
|
|
}
|
|
static inline void kmemleak_update_trace(const void *ptr)
|
|
{
|
|
}
|
|
static inline void kmemleak_not_leak(const void *ptr)
|
|
{
|
|
}
|
|
static inline void kmemleak_ignore(const void *ptr)
|
|
{
|
|
}
|
|
static inline void kmemleak_scan_area(const void *ptr, size_t size, gfp_t gfp)
|
|
{
|
|
}
|
|
static inline void kmemleak_erase(void **ptr)
|
|
{
|
|
}
|
|
static inline void kmemleak_no_scan(const void *ptr)
|
|
{
|
|
}
|
|
|
|
#endif /* CONFIG_DEBUG_KMEMLEAK */
|
|
|
|
#endif /* __KMEMLEAK_H */
|