From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751980AbbEAUgK (ORCPT ); Fri, 1 May 2015 16:36:10 -0400 Received: from mta01.ornl.gov ([128.219.177.14]:1672 "EHLO mta01.ornl.gov" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750973AbbEAUgH convert rfc822-to-8bit (ORCPT ); Fri, 1 May 2015 16:36:07 -0400 X-SG: RELAYLIST X-IronPort-AV: E=Sophos;i="5.13,352,1427774400"; d="scan'208";a="102181700" From: "Simmons, James A." To: "'Dan Carpenter'" CC: "'Julia Lawall'" , Oleg Drokin , "devel@driverdev.osuosl.org" , Greg Kroah-Hartman , "kernel-janitors@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "HPDD-discuss@lists.01.org" Subject: RE: [HPDD-discuss] [PATCH 2/11] Staging: lustre: fld: Use kzalloc and kfree Thread-Topic: [HPDD-discuss] [PATCH 2/11] Staging: lustre: fld: Use kzalloc and kfree Thread-Index: AQHQhEnFtZ4DSIwx+UqGFhRrgQwaK51nkr1w Date: Fri, 1 May 2015 20:36:05 +0000 Message-ID: <9f81478864bc422c9a59cddbaa723052@EXCHCS32.ornl.gov> References: <1430495482-933-1-git-send-email-Julia.Lawall@lip6.fr> <1430495482-933-11-git-send-email-Julia.Lawall@lip6.fr> <20150501200221.GF14154@mwanda> In-Reply-To: <20150501200221.GF14154@mwanda> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [128.219.12.132] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org >We are hopefully going to get rid of OBD_ALLOC_LARGE() as well, though. > >It's simple enough to write a function: > >void *obd_zalloc(size_t size) >{ > if (size > 4 * PAGE_CACHE_SIZE) > return vzalloc(size); > else > return kmalloc(size, GFP_NOFS); >} > >Except, huh? Shouldn't we be using GFP_NOFS for the vzalloc() side? >There was some discussion of that GFP_NOFS was a bit buggy back in 2010 >(http://marc.info/?l=linux-mm&m=128942194520631&w=4) but the current >lustre code doesn't try to pass GFP_NOFS. The version in the upstream client is out of date. The current macro in the Intel master Branch is: #define __OBD_VMALLOC_VERBOSE(ptr, cptab, cpt, size) \ do { \ (ptr) = cptab == NULL ? \ __vmalloc(size, GFP_NOFS | __GFP_HIGHMEM | __GFP_ZERO, \ PAGE_KERNEL) : \ cfs_cpt_vzalloc(cptab, cpt, size); \ if (unlikely((ptr) == NULL)) { \ CERROR("vmalloc of '" #ptr "' (%d bytes) failed\n", \ (int)(size)); \ CERROR(LPU64" total bytes allocated by Lustre, %d by LNET\n", \ obd_memory_sum(), atomic_read(&libcfs_kmemory)); \ } else { \ OBD_ALLOC_POST(ptr, size, "vmalloced"); \ } \ } while(0) >Then it's simple enough to change OBD_FREE_LARGE() to kvfree(). > >Also it's weird that only the lustre people have thought of this trick >to allocate big chunks of RAM and no one else has. What would happen if >we just change vmalloc() so it worked this way for everyone? Do we really want to encourage vmalloc usages?