From: Andrew Morton <akpm@linux-foundation.org>
To: Axel Lin <axel.lin@ingics.com>
Cc: linux-kernel@vger.kernel.org, Al Viro <viro@zeniv.linux.org.uk>,
Brian Norris <computersforpeace@gmail.com>,
Artem Bityutskiy <artem.bityutskiy@linux.intel.com>,
"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Subject: Re: BUG: sleeping function called from invalid context at kernel/locking/mutex.c:616
Date: Wed, 4 Dec 2013 13:32:20 -0800 [thread overview]
Message-ID: <20131204133220.a7f38e748ce2c57f90483111@linux-foundation.org> (raw)
In-Reply-To: <1386147578.20621.4.camel@phoenix>
On Wed, 04 Dec 2013 16:59:38 +0800 Axel Lin <axel.lin@ingics.com> wrote:
> >
> > Please add a lot more printk's so we can narrow it down further? I'd
> > use something like
> >
> > printk(%d: %d\n", __LINE__, preempt_count());
> >
> > (note: preempt_count(), not in_atomic())
> >
> > Paste that all over the place so we can see which statement is doing
> > the wrong thing.
>
> Below is the code ( to show the line number ):
>
> 459 int add_to_page_cache_locked(struct page *page, struct address_space
> *mapping,
> 460 pgoff_t offset, gfp_t gfp_mask)
> 461 {
> 462 int error;
> 463
> 464 VM_BUG_ON(!PageLocked(page));
> 465 VM_BUG_ON(PageSwapBacked(page));
> 466
> 467 printk("%d: %d\n", __LINE__, preempt_count());
> 468 error = mem_cgroup_cache_charge(page, current->mm,
> 469 gfp_mask &
> GFP_RECLAIM_MASK);
> 470 printk("%d: %d\n", __LINE__, preempt_count());
> 471 if (error)
> 472 return error;
> 473
> 474 error = radix_tree_maybe_preload(gfp_mask &
> ~__GFP_HIGHMEM);
> 475 printk("%d: %d\n", __LINE__, preempt_count());
> 476 if (error) {
> 477 mem_cgroup_uncharge_cache_page(page);
> 478 return error;
> 479 }
> 480
> 481 page_cache_get(page);
> 482 page->mapping = mapping;
> 483 page->index = offset;
> 484
> 485 printk("%d: %d\n", __LINE__, preempt_count());
> 486 spin_lock_irq(&mapping->tree_lock);
> 487 printk("%d: %d\n", __LINE__, preempt_count());
> 488 error = radix_tree_insert(&mapping->page_tree, offset,
> page);
> 489 printk("%d: %d\n", __LINE__, preempt_count());
> 490 radix_tree_preload_end();
> 491 printk("%d: %d\n", __LINE__, preempt_count());
> 492 if (unlikely(error))
> 493 goto err_insert;
> 494 printk("%d: %d\n", __LINE__, preempt_count());
> 495 mapping->nrpages++;
> 496 printk("%d: %d\n", __LINE__, preempt_count());
> 497 __inc_zone_page_state(page, NR_FILE_PAGES);
> 498 printk("%d: %d\n", __LINE__, preempt_count());
> 499 spin_unlock_irq(&mapping->tree_lock);
> 500 printk("%d: %d\n", __LINE__, preempt_count());
> 501 trace_mm_filemap_add_to_page_cache(page);
> 502 printk("%d: %d\n", __LINE__, preempt_count());
> 503 return 0;
> 504 err_insert:
> 505 page->mapping = NULL;
> 506 /* Leave page->index set: truncation relies upon it */
> 507 spin_unlock_irq(&mapping->tree_lock);
> 508 mem_cgroup_uncharge_cache_page(page);
> 509 page_cache_release(page);
> 510 printk("%d: %d\n", __LINE__, preempt_count());
> 511 return error;
> 512 }
>
> Below is the output log:
>
> VFS: Mounted root (jffs2 filesystem) on device 31:1.
> devtmpfs: mounted
> Freeing unused kernel memory: 92K (003a8000 - 003bf000)
> 467: 0
> 470: 0
> 475: 1
> 485: 1
> 487: 2
> 489: 2
> 491: 1
> 494: 1
> 496: 1
> 498: 1
> 500: 0
> 502: 0
> 467: 0
> 470: 0
> 475: 1
> 485: 1
> 487: 2
> 489: 2
> 491: 1
> 494: 1
> 496: 1
> 498: 1
> 500: 0
> 502: 0
> 467: 0
> 470: 0
> 475: 1
> 485: 1
> 487: 2
> 489: 2
> 491: 1
> 494: 1
> 496: 1
> 498: 1
> 500: 1
blam. spin_unlock_irq(&mapping->tree_lock) failed to decrement
preempt_count(). What the heck.
What architecture is this? Please send the full .config.
And exactly which kernel version is in use?
Thanks.
> 502: 1
> BUG: sleeping function called from invalid context at kernel/locking/mutex.c:616
> in_atomic(): 1, irqs_disabled(): 128, pid: 1, name: swapper
> 1 lock held by swapper/1:
next prev parent reply other threads:[~2013-12-04 21:32 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-01 10:53 Axel Lin
2013-12-04 8:13 ` Axel Lin
2013-12-04 8:31 ` Andrew Morton
2013-12-04 8:59 ` Axel Lin
2013-12-04 21:32 ` Andrew Morton [this message]
2013-12-05 7:12 ` Axel Lin
2013-12-05 7:22 ` Andrew Morton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20131204133220.a7f38e748ce2c57f90483111@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=artem.bityutskiy@linux.intel.com \
--cc=axel.lin@ingics.com \
--cc=computersforpeace@gmail.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®