Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759531Ab1FQSlZ (ORCPT ); Fri, 17 Jun 2011 14:41:25 -0400 Received: from outcampmail001.snc4.facebook.com ([66.220.144.159]:65423 "EHLO mx-out.facebook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752353Ab1FQSlY (ORCPT ); Fri, 17 Jun 2011 14:41:24 -0400 Message-ID: <4DFBA001.4010500@fb.com> Date: Fri, 17 Jun 2011 11:42:09 -0700 From: Arun Sharma User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.17) Gecko/20110414 Thunderbird/3.1.10 MIME-Version: 1.0 To: Mike Frysinger CC: linux-kernel@vger.kernel.org, Andrew Morton , Eric Dumazet , Ingo Molnar , David Miller Subject: Re: [PATCH] atomic: cleanup asm-generic atomic*.h inclusion References: <20110615163115.773d072e.akpm@linux-foundation.org> <1308187784-3815-1-git-send-email-asharma@fb.com> <4DFB8AAF.1040002@fb.com> <4DFB93C1.9000901@fb.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2516 Lines: 71 On 6/17/11 11:06 AM, Mike Frysinger wrote: > fixes one thing while breaking another. linux/atomic.h includes > asm/atomic.h which includes asm-generic/atomic.h which includes > asm-generic/atomic-long.h which needs atomic_add_unless(), but that > isnt provided until after the asm/atomic.h include in linux/atomic.h. > > but linux/atomic.h needs asm/atomic.h before atomic_add_unless() > because it relies on the new __atomic_add_unless(). > Right. I think we need to get rid of that include as well: --- a/include/asm-generic/atomic.h +++ b/include/asm-generic/atomic.h @@ -156,7 +145,5 @@ static inline void atomic_clear_mask(unsigned long mask, unsigned long *addr) #define smp_mb__before_atomic_inc() barrier() #define smp_mb__after_atomic_inc() barrier() -#include - #endif /* __KERNEL__ */ #endif /* __ASM_GENERIC_ATOMIC_H */ since includes it directly now. > having linux/atomic.h and asm-generic/atomic.h just strikes me as > wrong. the point of asm-generic is to unify things, but now we have > two places to unify things without 0 indication as to which is for > which ? i'm wondering if we shouldnt convert all arches to > asm-generic/atomic.h and then add your new logic there and just skip > this whole linux/atomic.h mess. I believe the logic is: shared code for simple archs that don't want to define their own primitives. Only used by 4 archs. a header file that's usable in machine independent kernel code. seems to be relatively recent, introduced by: commit 3f9d35b9514da6757ca98831372518f9eeb71b33 Author: Eric Dumazet Date: Thu Nov 11 14:05:08 2010 -0800 atomic: add atomic_inc_not_zero_hint() came from: commit d3cb487149bd706aa6aeb02042332a450978dc1c Author: Christoph Lameter Date: Fri Jan 6 00:11:20 2006 -0800 [PATCH] atomic_long_t & include/asm-generic/atomic.h V2 My guess is that if existed in 2006, people would've added shared code over there. Also, the code in is not truly generic: smp_mb__before_atomic_dec() for eg is implemented differently for some archs. -Arun -- 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/