From owner-freebsd-current@FreeBSD.ORG Wed Aug 22 11:41:59 2012 Return-Path: Delivered-To: current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 106321065677 for ; Wed, 22 Aug 2012 11:41:59 +0000 (UTC) (envelope-from luigi@onelab2.iet.unipi.it) Received: from onelab2.iet.unipi.it (onelab2.iet.unipi.it [131.114.59.238]) by mx1.freebsd.org (Postfix) with ESMTP id C44958FC18 for ; Wed, 22 Aug 2012 11:41:58 +0000 (UTC) Received: by onelab2.iet.unipi.it (Postfix, from userid 275) id A6DCA7300A; Wed, 22 Aug 2012 14:01:05 +0200 (CEST) Date: Wed, 22 Aug 2012 14:01:05 +0200 From: Luigi Rizzo To: current@freebsd.org Message-ID: <20120822120105.GA63763@onelab2.iet.unipi.it> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.2.3i Cc: Subject: less aggressive contigmalloc ? X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Aug 2012 11:41:59 -0000 I am trying to make netmap adapt the amount of memory it allocates to what is available. At its core, it uses contigmalloc() with small chunks (even down to 1 page) to fetch memory. Problem is, i notice that before failing, contigmalloc() tries to swap out some processes (effectively killing them because i have no swap configured in my picobsd image). This happens with both M_WAITOK and M_NOWAIT, the difference is only in the number of retries it does -- see e.g. sys/vm/vm_kern.c :: kmem_alloc_contig() where it retries once for M_NOWAIT and 3 times for M_WAITOK. I wonder if there is a way to make contigmalloc less aggressive and fail without killing those innocent processes ? cheers luigi