Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932191AbVLUVWb (ORCPT ); Wed, 21 Dec 2005 16:22:31 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1750996AbVLUVWb (ORCPT ); Wed, 21 Dec 2005 16:22:31 -0500 Received: from omx2-ext.sgi.com ([192.48.171.19]:58349 "EHLO omx2.sgi.com") by vger.kernel.org with ESMTP id S1750745AbVLUVWa (ORCPT ); Wed, 21 Dec 2005 16:22:30 -0500 Date: Wed, 21 Dec 2005 13:22:24 -0800 (PST) From: Christoph Lameter To: Ravikiran G Thirumalai cc: Andrew Morton , linux-kernel@vger.kernel.org, "Shai Fultheim (Shai@scalex86.org)" , nippung@calsoftinc.com Subject: Re: [rfc][patch] Avoid taking global tasklist_lock for single threaded process at getrusage() In-Reply-To: <20051221211135.GB4514@localhost.localdomain> Message-ID: References: <20051221182320.GA4514@localhost.localdomain> <20051221211135.GB4514@localhost.localdomain> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1154 Lines: 27 On Wed, 21 Dec 2005, Ravikiran G Thirumalai wrote: > We did look at that. Cases RUSAGE_CHILDREN and RUSAGE_SELF are always called by the > current task, so we can avoid tasklist locking there. > getrusage for non-current tasks are always called with RUSAGE_BOTH. > We ensure we always take the siglock for RUSAGE_BOTH case, so that the > p->signal* fields are protected and take the tasklist_lock only if we have > to traverse the tasklist hashlist. Isn't this safe? Sounds okay. But its complex in the way its is coded now and its easy to assume that one can call getrusage with any parameter from inside the kernel. Maybe we can have a couple of separate functions rusage_children() rusage_self() rusage_both() ? Only rusage_both would take a task_struct * parameter. The others would only operate on current. Change all the locations that call getrusage with RUSAGE_BOTH to call rusage_both(). - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/