Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932388Ab1EQV2K (ORCPT ); Tue, 17 May 2011 17:28:10 -0400 Received: from mx3.mail.elte.hu ([157.181.1.138]:44339 "EHLO mx3.mail.elte.hu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932269Ab1EQV2J (ORCPT ); Tue, 17 May 2011 17:28:09 -0400 Date: Tue, 17 May 2011 23:27:34 +0200 From: Ingo Molnar To: John Stultz Cc: LKML , Joe Perches , Michal Nazarewicz , Andy Whitcroft , Jiri Slaby , KOSAKI Motohiro , David Rientjes , Dave Hansen , Andrew Morton , linux-mm@kvack.org, Peter Zijlstra Subject: Re: [PATCH 1/3] comm: Introduce comm_lock spinlock to protect task->comm access Message-ID: <20110517212734.GB28054@elte.hu> References: <1305665263-20933-1-git-send-email-john.stultz@linaro.org> <1305665263-20933-2-git-send-email-john.stultz@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1305665263-20933-2-git-send-email-john.stultz@linaro.org> User-Agent: Mutt/1.5.20 (2009-08-17) X-ELTE-SpamScore: -2.0 X-ELTE-SpamLevel: X-ELTE-SpamCheck: no X-ELTE-SpamVersion: ELTE 2.0 X-ELTE-SpamCheck-Details: score=-2.0 required=5.9 tests=BAYES_00 autolearn=no SpamAssassin version=3.3.1 -2.0 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 899 Lines: 25 * John Stultz wrote: > The implicit rules for current->comm access being safe without locking are no > longer true. Accessing current->comm without holding the task lock may result > in null or incomplete strings (however, access won't run off the end of the > string). This is rather unfortunate - task->comm is used in a number of performance critical codepaths such as tracing. Why does this matter so much? A NULL string is not a big deal. Note, since task->comm is 16 bytes there's the CMPXCHG16B instruction on x86 which could be used to update it atomically, should atomicity really be desired. Thanks, Ingo -- 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/