Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751309AbWEJTko (ORCPT ); Wed, 10 May 2006 15:40:44 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751250AbWEJTko (ORCPT ); Wed, 10 May 2006 15:40:44 -0400 Received: from dsl027-180-168.sfo1.dsl.speakeasy.net ([216.27.180.168]:13218 "EHLO sunset.davemloft.net") by vger.kernel.org with ESMTP id S1751229AbWEJTkn (ORCPT ); Wed, 10 May 2006 15:40:43 -0400 Date: Wed, 10 May 2006 12:40:03 -0700 (PDT) Message-Id: <20060510.124003.04457042.davem@davemloft.net> To: rth@twiddle.net Cc: paulus@samba.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linuxppc-dev@ozlabs.org Subject: Re: [RFC/PATCH] Make powerpc64 use __thread for per-cpu variables From: "David S. Miller" In-Reply-To: <20060510154702.GA28938@twiddle.net> References: <17505.26159.807484.477212@cargo.ozlabs.ibm.com> <20060510154702.GA28938@twiddle.net> X-Mailer: Mew version 4.2.53 on Emacs 21.4 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1035 Lines: 37 From: Richard Henderson Date: Wed, 10 May 2006 08:47:13 -0700 > How do you plan to address the compiler optimizing ... > Across the schedule, we may have changed cpus, making the cached > address invalid. Per-cpu variables need to be accessed only with preemption disabled. And the preemption enable/disable operations provide a compiler memory barrier. #define preempt_disable() \ do { \ inc_preempt_count(); \ barrier(); \ } while (0) ... #define preempt_enable() \ do { \ preempt_enable_no_resched(); \ barrier(); \ preempt_check_resched(); \ } while (0) The scheduler itself need to take care to not cause the situation you mention either. Therefore this is an issue we had already, not some new thing introduced by using __thread for per-cpu variables. - 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/