From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755042Ab1ACOJ4 (ORCPT ); Mon, 3 Jan 2011 09:09:56 -0500 Received: from mail-qw0-f46.google.com ([209.85.216.46]:44313 "EHLO mail-qw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754767Ab1ACOJy convert rfc822-to-8bit (ORCPT ); Mon, 3 Jan 2011 09:09:54 -0500 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type :content-transfer-encoding; b=A29Y3hZR60pqisMmru67zsPvTKSA8wYaTuZUqWOOFWQ/vBBUlqc7CAINwN2x6nmT9z 1ZOyowtpQlsyNJnST57Gd4UTySQ9LsprGxsteywz8pauwfZCQsq1MGGm5FKvcqaAUG+P CtXKlE9lRaSY0Vqb0szRO9Up53SZAtKt1wpOg= MIME-Version: 1.0 In-Reply-To: <20110103135815.GA6024@thunk.org> References: <20110103135815.GA6024@thunk.org> Date: Mon, 3 Jan 2011 16:09:52 +0200 X-Google-Sender-Auth: bT51vN3q_UiJOyrzjAyepw3gAkA Message-ID: Subject: Re: Should we be using unlikely() around tests of GFP_ZERO? From: Pekka Enberg To: "Ted Ts'o" , Pekka Enberg , Minchan Kim , Christoph Lameter , Pekka Enberg , Matt Mackall , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Steven Rostedt , David Rientjes , npiggin@kernel.dk Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Ted, On Mon, Jan 03, 2011 at 09:40:57AM +0200, Pekka Enberg wrote: >> I guess the rationale here is that if you're going to take the hit of >> memset() you can take the hit of unlikely() as well. We're optimizing >> for hot call-sites that allocate a small amount of memory and >> initialize everything themselves. That said, I don't think the >> unlikely() annotation matters much either way and am for removing it >> unless people object to that. On Mon, Jan 3, 2011 at 3:58 PM, Ted Ts'o wrote: > I suspect for many slab caches, all of the slab allocations for a > given slab cache type will have the GFP_ZERO flag passed.  So maybe it > would be more efficient to zap the entire page when it is pressed into > service for a particular slab cache, so we can avoid needing to use > memset on a per-object basis? We'd then need to do memset() in kmem_cache_free() because callers are not required to clean up after them. In general, we don't want to do that because object cachelines are less likely to be touched after free than they are after allocation (you usually use the memory immediately after you allocate). Pekka