Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756291Ab2F0XnQ (ORCPT ); Wed, 27 Jun 2012 19:43:16 -0400 Received: from mail-wi0-f178.google.com ([209.85.212.178]:53473 "EHLO mail-wi0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751910Ab2F0XnO (ORCPT ); Wed, 27 Jun 2012 19:43:14 -0400 MIME-Version: 1.0 In-Reply-To: <1340838106.10063.85.camel@twins> References: <20120627211540.459910855@chello.nl> <20120627212830.693232452@chello.nl> <1340838106.10063.85.camel@twins> From: Linus Torvalds Date: Wed, 27 Jun 2012 16:42:52 -0700 X-Google-Sender-Auth: HY5ig1WAuLrUxyZ_GKJ-Z_YwD4k Message-ID: Subject: Re: [PATCH 02/20] mm: Add optional TLB flush to generic RCU page-table freeing To: Peter Zijlstra Cc: linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org, Thomas Gleixner , Ingo Molnar , akpm@linux-foundation.org, Rik van Riel , Hugh Dickins , Mel Gorman , Nick Piggin , Alex Shi , "Nikunj A. Dadhania" , Konrad Rzeszutek Wilk , Benjamin Herrenschmidt , David Miller , Russell King , Catalin Marinas , Chris Metcalf , Martin Schwidefsky , Tony Luck , Paul Mundt , Jeff Dike , Richard Weinberger , Ralf Baechle , Kyle McMartin , James Bottomley , Chris Zankel Content-Type: text/plain; charset=ISO-8859-1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1449 Lines: 47 On Wed, Jun 27, 2012 at 4:01 PM, Peter Zijlstra wrote: > > How about something like this Looks better. I'd be even happier if you made the whole "When there's less then two users.." (There's a misspelling there, btw, I didn't notice until I cut-and-pasted that) logic be a helper function, and have that helper function be inside that same #ifdef CONFIG_STRICT_TLB_FILL block together witht he tlb_table_flush_mmu() function. IOW, something like static int tlb_remove_table_quick( struct mmu_gather *tlb, void *table) { if (atomic_read(&tlb->mm->mm_users) < 2) { __tlb_remove_table(table); return 1; } return 0; } for the CONFIG_STRICT_TLB_FILL case, and then the default case just does an unconditional "return 0". So that the actual code can avoid having #ifdef's in the middle of a function, and could just do if (tlb_remove_table_quick(tlb, table)) return; instead. Maybe it's just me, but I detest seeing #ifdef's in the middle of code. I'd much rather have the #ifdef's *outside* the code and have these kinds of helper functions that sometimes end up becoming empty. Linus -- 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/