From owner-freebsd-arch@FreeBSD.ORG Thu Nov 29 10:30:09 2012 Return-Path: Delivered-To: freebsd-arch@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1B2F4E21; Thu, 29 Nov 2012 10:30:09 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id E43B78FC15; Thu, 29 Nov 2012 10:30:08 +0000 (UTC) Received: from fledge.watson.org (fledge.watson.org [65.122.17.41]) by cyrus.watson.org (Postfix) with ESMTPS id 098DC46B2A; Thu, 29 Nov 2012 05:30:08 -0500 (EST) Date: Thu, 29 Nov 2012 10:30:07 +0000 (GMT) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Pawel Jakub Dawidek Subject: Re: Print a (rate-limited) warning when UMA zone is full. In-Reply-To: <20121129090147.GB1370@garage.freebsd.pl> Message-ID: References: <20121129090147.GB1370@garage.freebsd.pl> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: freebsd-arch@FreeBSD.org X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Nov 2012 10:30:09 -0000 On Thu, 29 Nov 2012, Pawel Jakub Dawidek wrote: > I'd like to propose the following patch: > > http://people.freebsd.org/~pjd/patches/uma_warning.patch > > When UMA zone is created, one can add configure a warning that should be > printed when UMA zone is full by calling: > > uma_zone_set_warning(socket_zone, > "kern.ipc.maxsockets limit exceeded, please see tuning(7)."); > > It was very easy to find and fix the problem when I saw messages on the > console that kern.maxfiles limit is reached, but when I hit > kern.ipc.maxsockets limit and started to get ENOBUFS errors it took me a > while to figure out what to tune. > > This patch allows to configure advice for the use and give him some details > in a very easy way. The warning printed on the console is rate-limited to > one per second. Just to follow up on some out-of-band communication -- this is a good idea, but there was some concern about printf() under mutexes. I'm not actually that concerned about that case (we do it quite a lot for warnings and kernel debugging), but it might be useful to consider using log() instead, so that it ends up in the system log as well as on the console. For I while I've wondered if we need a spp to complement pps -- that is, limiting printf()s to every (n) seconds, rather than (n) per second. For tunable warnings like this, it would be nice to limit them to once a minute or similar. Finally, we should make sure that in all instances where we point at tuning(7), it has something useful to say about the topic :-). Robert