From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758039AbZLKNus (ORCPT ); Fri, 11 Dec 2009 08:50:48 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1757677AbZLKNuo (ORCPT ); Fri, 11 Dec 2009 08:50:44 -0500 Received: from mx1.redhat.com ([209.132.183.28]:43768 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757571AbZLKNuo (ORCPT ); Fri, 11 Dec 2009 08:50:44 -0500 Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 From: David Howells In-Reply-To: <20091210004703.148689096@linutronix.de> References: <20091210004703.148689096@linutronix.de> <20091210001308.247025548@linutronix.de> To: Thomas Gleixner Cc: dhowells@redhat.com, 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 Date: Fri, 11 Dec 2009 13:49:31 +0000 Message-ID: <13284.1260539371@redhat.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. David From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail144.messagelabs.com (mail144.messagelabs.com [216.82.254.51]) by kanga.kvack.org (Postfix) with SMTP id 2D32D6B0044 for ; Fri, 11 Dec 2009 08:49:51 -0500 (EST) From: David Howells In-Reply-To: <20091210004703.148689096@linutronix.de> References: <20091210004703.148689096@linutronix.de> <20091210001308.247025548@linutronix.de> Subject: Re: [patch 4/9] oom: Add missing rcu protection of __task_cred() in dump_tasks Date: Fri, 11 Dec 2009 13:49:31 +0000 Message-ID: <13284.1260539371@redhat.com> Sender: owner-linux-mm@kvack.org To: Thomas Gleixner Cc: dhowells@redhat.com, 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: 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. David -- 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