From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail143.messagelabs.com (mail143.messagelabs.com [216.82.254.35]) by kanga.kvack.org (Postfix) with SMTP id 60BBA6B02D0 for ; Mon, 9 Aug 2010 14:57:45 -0400 (EDT) Received: by gwj16 with SMTP id 16so4581671gwj.14 for ; Mon, 09 Aug 2010 11:57:43 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <1281374816-904-5-git-send-email-ngupta@vflare.org> References: <1281374816-904-1-git-send-email-ngupta@vflare.org> <1281374816-904-5-git-send-email-ngupta@vflare.org> Date: Mon, 9 Aug 2010 21:57:42 +0300 Message-ID: Subject: Re: [PATCH 04/10] Use percpu buffers From: Pekka Enberg Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Sender: owner-linux-mm@kvack.org To: Nitin Gupta Cc: Pekka Enberg , Minchan Kim , Andrew Morton , Greg KH , Linux Driver Project , linux-mm , linux-kernel List-ID: On Mon, Aug 9, 2010 at 8:26 PM, Nitin Gupta wrote: > @@ -303,38 +307,41 @@ static int zram_write(struct zram *zram, struct bio= *bio) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0zram_test_= flag(zram, index, ZRAM_ZERO)) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0zram_free_page(zram, index= ); > > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 mutex_lock(&zram->lock); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 preempt_disable(); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 zbuffer =3D __get_cpu_var(compress_buffer); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 zworkmem =3D __get_cpu_var(compress_workmem= ); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (unlikely(!zbuffer || !zworkmem)) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 preempt_enable(); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 goto out; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } The per-CPU buffer thing with this preempt_disable() trickery looks overkill to me. Most block device drivers seem to use mempool_alloc() for this sort of thing. Is there some reason you can't use that here? -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org