Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753996Ab0LFSLq (ORCPT ); Mon, 6 Dec 2010 13:11:46 -0500 Received: from waste.org ([173.11.57.241]:43327 "EHLO waste.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752297Ab0LFSLp (ORCPT ); Mon, 6 Dec 2010 13:11:45 -0500 Subject: Re: [cpuops inc_return V1 8/9] random: Use this_cpu_inc_return From: Matt Mackall To: Christoph Lameter Cc: Tejun Heo , akpm@linux-foundation.org, Richard Kennedy , Pekka Enberg , linux-kernel@vger.kernel.org, Eric Dumazet , Mathieu Desnoyers In-Reply-To: <20101206174017.684979312@linux.com> References: <20101206173958.685460926@linux.com> <20101206174017.684979312@linux.com> Content-Type: text/plain; charset="UTF-8" Date: Mon, 06 Dec 2010 12:11:42 -0600 Message-ID: <1291659102.3065.2212.camel@calx> Mime-Version: 1.0 X-Mailer: Evolution 2.30.3 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 831 Lines: 22 On Mon, 2010-12-06 at 11:40 -0600, Christoph Lameter wrote: > plain text document attachment (cpuops_inc_return_random) > __this_cpu_inc can create a single instruction to do the same as > __get_cpu_var()++. > - (__get_cpu_var(trickle_count)++ & 0xfff)) > + ((__this_cpu_inc_return(trickle_count) - 1) & 0xfff)) I see you've added a "- 1" to mimic the post-increment ++ semantic. The goal of this code to add only 1 sample in every 4096, but we don't really care which, so this semantic isn't actually important here. -- Mathematics is the supreme nostalgia of our time. -- 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/