From mboxrd@z Thu Jan 1 00:00:00 1970 From: Johannes Weiner Subject: Re: [RFC] mm: change irqs_disabled() test to spin_is_locked() in mem_cgroup_swapout Date: Fri, 29 May 2015 15:11:59 -0400 Message-ID: <20150529191159.GA29078@cmpxchg.org> References: <20150529104815.2d2e880c@sluggy> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Thomas Gleixner , linux-mm@kvack.org, Andrew Morton , RT , Fernando Lopez-Lezcano , Steven Rostedt , Sebastian Andrzej Siewior To: Clark Williams Return-path: Received: from gum.cmpxchg.org ([85.214.110.215]:50139 "EHLO gum.cmpxchg.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756539AbbE2TMT (ORCPT ); Fri, 29 May 2015 15:12:19 -0400 Content-Disposition: inline In-Reply-To: <20150529104815.2d2e880c@sluggy> Sender: linux-rt-users-owner@vger.kernel.org List-ID: Hi Clark, On Fri, May 29, 2015 at 10:48:15AM -0500, Clark Williams wrote: > @@ -5845,7 +5845,7 @@ void mem_cgroup_swapout(struct page *page, > swp_entry_t entry) page_counter_uncharge(&memcg->memory, 1); > > /* XXX: caller holds IRQ-safe mapping->tree_lock */ > - VM_BUG_ON(!irqs_disabled()); > + VM_BUG_ON(!spin_is_locked(&page_mapping(page)->tree_lock)); > > mem_cgroup_charge_statistics(memcg, page, -1); It's not about the lock, it's about preemption. The charge statistics use __this_cpu operations and they're updated from process context and interrupt context both. This function really should do a local_irq_save(). I only added the VM_BUG_ON() to document that we know the caller is holding an IRQ-safe lock and so we don't need to bother with another level of IRQ saving. So how does this translate to RT? I don't know. But if switching to explicit IRQ toggling would help you guys out we can do that. It is in the swapout path after all, the optimization isn't that important.