Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754138AbbF3PBS (ORCPT ); Tue, 30 Jun 2015 11:01:18 -0400 Received: from mail2-relais-roc.national.inria.fr ([192.134.164.83]:6380 "EHLO mail2-relais-roc.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752321AbbF3PBL (ORCPT ); Tue, 30 Jun 2015 11:01:11 -0400 X-IronPort-AV: E=Sophos;i="5.15,378,1432591200"; d="scan'208";a="168091522" Date: Tue, 30 Jun 2015 17:01:03 +0200 (CEST) From: Julia Lawall X-X-Sender: jll@hadrien To: "Simmons, James A." cc: "'Dan Carpenter'" , Julia Lawall , "devel@driverdev.osuosl.org" , "Dilger, Andreas" , Greg Kroah-Hartman , "kernel-janitors@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "Drokin, Oleg" , "lustre-devel@lists.lustre.org" Subject: RE: LIBCFS_ALLOC In-Reply-To: Message-ID: References: <1434819550-3193-1-git-send-email-Julia.Lawall@lip6.fr> <1434819550-3193-2-git-send-email-Julia.Lawall@lip6.fr> <20150628215408.GG28762@mwanda> User-Agent: Alpine 2.10 (DEB 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1730 Lines: 34 On Tue, 30 Jun 2015, Simmons, James A. wrote: > >Yeah. You're right. Doing a vmalloc() when kmalloc() doesn't have even > >a tiny sliver of RAM isn't going to work. It's easier to use > >libcfs_kvzalloc() everywhere, but it's probably the wrong thing. > > The original reason we have the vmalloc water mark wasn't so much the > issue of memory exhaustion but to handle the case of memory fragmentation. > Some sites had after a extended period of time started to see failures of > allocating even 32K using kmalloc. In our latest development branch we moved > away from using a water mark to always try kmalloc first and if it fails then we > try vmalloc. At ORNL we ran into severe performance issues when we entered > vmalloc territory. It has been discussed before on what might replace vmalloc > handling in the case of kmalloc fails but no solution has been worked out. OK, but if a structure contains only 4 words, would it be better to just use kzalloc? Or does it not matter? It would only save trying vmalloc in a case that it is guaranteed to fail, but if a structure with 4 words can't be allocatted, the system has other problems. Another argument is that kzalloc is a well known function that people and bug-finding tools understand, so it is better to use it whenever possible. Some of the other structures contain a lot more fields, as well as small arrays. They are probably acceptable for kzalloc too, but I wouldn't know the exact dividing line. julia -- 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/