From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753271Ab3LTSFe (ORCPT ); Fri, 20 Dec 2013 13:05:34 -0500 Received: from qmta05.emeryville.ca.mail.comcast.net ([76.96.30.48]:43431 "EHLO qmta05.emeryville.ca.mail.comcast.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750963Ab3LTSFc (ORCPT ); Fri, 20 Dec 2013 13:05:32 -0500 Date: Fri, 20 Dec 2013 12:05:29 -0600 (CST) From: Christoph Lameter X-X-Sender: cl@nuc To: Dave Chinner cc: Dave Chinner , linux-kernel@vger.kernel.org, Alexander Viro Subject: Re: [fs] inode_lru_isolate(): Move counter increment into spinlock section In-Reply-To: <20131220033502.GF31386@dastard> Message-ID: References: <00000143072add16-956bfa6c-d7d5-4df9-aabc-05a904a0edc4-000000@email.amazonses.com> <20131219042322.GX31386@dastard> <20131220033502.GF31386@dastard> Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 20 Dec 2013, Dave Chinner wrote: > If count_vm_events requires irqs to be disabled to behave correctly, > then putting __count_vm_events under a spin lock is still not irq > safe. Either way, this isn't in a performance critical path, so I'd > much prefer the simpler, safer option be used rather than leave a > landmine for other unsuspecting developers. Subject: [fs] Use safe counter increment operations The counter increment in inode_lru_isolate is happening with preemption on using __count_vm_events making counter increment races possible. Use count_vm_events instead. Signed-off-by: Christoph Lameter Index: linux/fs/inode.c =================================================================== --- linux.orig/fs/inode.c 2013-12-20 12:02:14.409583380 -0600 +++ linux/fs/inode.c 2013-12-20 12:02:14.409583380 -0600 @@ -722,9 +722,9 @@ inode_lru_isolate(struct list_head *item unsigned long reap; reap = invalidate_mapping_pages(&inode->i_data, 0, -1); if (current_is_kswapd()) - __count_vm_events(KSWAPD_INODESTEAL, reap); + count_vm_events(KSWAPD_INODESTEAL, reap); else - __count_vm_events(PGINODESTEAL, reap); + count_vm_events(PGINODESTEAL, reap); if (current->reclaim_state) current->reclaim_state->reclaimed_slab += reap; }