From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758307AbZLKNxw (ORCPT ); Fri, 11 Dec 2009 08:53:52 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1758275AbZLKNxu (ORCPT ); Fri, 11 Dec 2009 08:53:50 -0500 Received: from www.tglx.de ([62.245.132.106]:37899 "EHLO www.tglx.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758267AbZLKNxs (ORCPT ); Fri, 11 Dec 2009 08:53:48 -0500 Date: Fri, 11 Dec 2009 14:52:48 +0100 (CET) From: Thomas Gleixner To: David Howells cc: LKML , "Paul E. McKenney" , Dipankar Sarma , Ingo Molnar , Peter Zijlstra , Oleg Nesterov , Al Viro , James Morris , Andrew Morton , Linus Torvalds , linux-mm@kvack.org Subject: Re: [patch 4/9] oom: Add missing rcu protection of __task_cred() in dump_tasks In-Reply-To: <13284.1260539371@redhat.com> Message-ID: References: <20091210004703.148689096@linutronix.de> <20091210001308.247025548@linutronix.de> <13284.1260539371@redhat.com> User-Agent: Alpine 2.00 (LFD 1167 2008-08-23) MIME-Version: 1.0 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, 11 Dec 2009, David Howells wrote: > Thomas Gleixner wrote: > > > + /* Protect __task_cred() access */ > > + rcu_read_lock(); > > printk(KERN_INFO "[%5d] %5d %5d %8lu %8lu %3d %3d %s\n", > > p->pid, __task_cred(p)->uid, p->tgid, mm->total_vm, > > get_mm_rss(mm), (int)task_cpu(p), p->signal->oom_adj, > > p->comm); > > + rcu_read_unlock(); > > No. If there's only one access to __task_cred() like this, use > task_cred_xxx() or one of its wrappers instead: > > - p->pid, __task_cred(p)->uid, p->tgid, mm->total_vm, > + p->pid, task_uid(p), p->tgid, mm->total_vm, > > that limits the size of the critical section. Fair enough. tglx From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail191.messagelabs.com (mail191.messagelabs.com [216.82.242.19]) by kanga.kvack.org (Postfix) with ESMTP id ACAB46B003D for ; Fri, 11 Dec 2009 08:53:18 -0500 (EST) Date: Fri, 11 Dec 2009 14:52:48 +0100 (CET) From: Thomas Gleixner Subject: Re: [patch 4/9] oom: Add missing rcu protection of __task_cred() in dump_tasks In-Reply-To: <13284.1260539371@redhat.com> Message-ID: References: <20091210004703.148689096@linutronix.de> <20091210001308.247025548@linutronix.de> <13284.1260539371@redhat.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-linux-mm@kvack.org To: David Howells Cc: LKML , "Paul E. McKenney" , Dipankar Sarma , Ingo Molnar , Peter Zijlstra , Oleg Nesterov , Al Viro , James Morris , Andrew Morton , Linus Torvalds , linux-mm@kvack.org List-ID: On Fri, 11 Dec 2009, David Howells wrote: > Thomas Gleixner wrote: > > > + /* Protect __task_cred() access */ > > + rcu_read_lock(); > > printk(KERN_INFO "[%5d] %5d %5d %8lu %8lu %3d %3d %s\n", > > p->pid, __task_cred(p)->uid, p->tgid, mm->total_vm, > > get_mm_rss(mm), (int)task_cpu(p), p->signal->oom_adj, > > p->comm); > > + rcu_read_unlock(); > > No. If there's only one access to __task_cred() like this, use > task_cred_xxx() or one of its wrappers instead: > > - p->pid, __task_cred(p)->uid, p->tgid, mm->total_vm, > + p->pid, task_uid(p), p->tgid, mm->total_vm, > > that limits the size of the critical section. Fair enough. tglx -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org