Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751221AbVLUVLk (ORCPT ); Wed, 21 Dec 2005 16:11:40 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751223AbVLUVLk (ORCPT ); Wed, 21 Dec 2005 16:11:40 -0500 Received: from ns1.siteground.net ([207.218.208.2]:38342 "EHLO serv01.siteground.net") by vger.kernel.org with ESMTP id S1751221AbVLUVLj (ORCPT ); Wed, 21 Dec 2005 16:11:39 -0500 Date: Wed, 21 Dec 2005 13:11:35 -0800 From: Ravikiran G Thirumalai To: Christoph Lameter 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() Message-ID: <20051221211135.GB4514@localhost.localdomain> References: <20051221182320.GA4514@localhost.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.1i X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - serv01.siteground.net X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [0 0] / [47 12] X-AntiAbuse: Sender Address Domain - scalex86.org X-Source: X-Source-Args: X-Source-Dir: Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1584 Lines: 36 On Wed, Dec 21, 2005 at 12:20:20PM -0800, Christoph Lameter wrote: > On Wed, 21 Dec 2005, Ravikiran G Thirumalai wrote: > > > Following patch avoids taking the global tasklist_lock when possible, > > if a process is single threaded during getrusage(). Any avoidance of > > tasklist_lock is good for NUMA boxes (and possibly for large SMPs). We found > > that this optimization reduces the runtime of a certain scientific application > > by half on a 16 cpu NUMA box. > > > > This optimization is similar to the sys_times tasklist_lock optimization. > > The optimization of sys_times is only possible because the "current" > task is running and therefore guarantees that the thread will not be > exiting. Yes. > > getrusage and k_getrusage can be called onother tasks than the currently > executing task and in those cases better take the tasklist lock because > the task may exit while getrusage runs. 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? Thanks, Kiran - 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/