Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 10 Jul 2003 20:40:27 +1000 (EST)
From:      Bruce Evans <bde@zeta.org.au>
To:        Dag-Erling =?iso-8859-1?q?Sm=F8rgrav?= <des@des.no>
Cc:        Current <freebsd-current@freebsd.org>
Subject:   Re: Panic linux ldconfig with MUTEX_PROFILING
Message-ID:  <20030710202221.J25371@gamplex.bde.org>
In-Reply-To: <xzpznjm7uyr.fsf@dwp.des.no>
References:  <7msmpv3lq0.wl@black.imgsrc.co.jp> <xzpznjm7uyr.fsf@dwp.des.no>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 10 Jul 2003, Dag-Erling [iso-8859-1] Sm=F8rgrav wrote:

> Jun Kuriyama <kuriyama@imgsrc.co.jp> writes:
> > I'm trying to use MUTEX_PROFILING, but paniced in linux ldconfig.
> > Any clues?
>
> is COMPAT_LINUX compiled into the kernel?  You can't use modules with
> MUTEX_PROFILING; it changes the size and layout of struct mtx, and
> since modules aren't built with the same options as the kernel, they
> use the wrong struct mtx.

This was broken in rev.1.9 of _mutex.h:

% RCS file: /home/ncvs/src/sys/sys/_mutex.h,v
% Working file: _mutex.h
% head: 1.9
% ...
% ----------------------------
% revision 1.9
% date: 2002/12/29 11:14:41;  author: phk;  state: Exp;  lines: +6 -1
% Save 16 bytes per mutex if MUTEX_PROFILING is not defined.
%
% MUTEX_PROFILING is in opt_global.h, so this does not introduce a risk of
                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
% variant structure sizes unless foreign kernel modules are used.
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
%
% This saved 16 bytes per vnode and 16 bytes per vm object for a total of
% 4MB on a 2GB machine.
%
% Idea from:=09alc
% ----------------------------

Actually, this ensures variant struct sizes if *any* kernel module is used.

The saving is machine-dependent (24 instead of 16 on most 64-bit
machines).  If bloat is a problem, then there is plenty more in the
mutex struct (not to mention the vnode struct) that could be attacked
(mainly for LOCK_DEBUG in the case of mutexes).  I think mutex profiling
should use external data, but this would be less efficient and more
work to implement.  Perhaps similarly for LOCK_DEBUG, but LOCK_DEBUG is
still needed in most configurations, unlike MUTEX_PROFILING.

Bruce



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030710202221.J25371>