From owner-svn-src-all@freebsd.org Sun Oct 22 14:50:43 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 51073E541CA; Sun, 22 Oct 2017 14:50:43 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-qk0-x22c.google.com (mail-qk0-x22c.google.com [IPv6:2607:f8b0:400d:c09::22c]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0606F6862E; Sun, 22 Oct 2017 14:50:43 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-qk0-x22c.google.com with SMTP id y23so19226760qkb.10; Sun, 22 Oct 2017 07:50:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=yjqikO2xZnf8ucMbhiNDosvmpF8CpZ99dwiR19s71+8=; b=fJlIxkkIB29dyh48qBX/GpQzgf24a4qEBMhxglGj/cvdTQzeTvt/ybhwSJHW3ygsme PIrGs096WyvJGrsGMRlIuQg4fYD8vaEqzP4trPkf/ISEeLNor5WE5kiGCMgPefAC69+w 05V3AQKlxd9IzJecdkbq46L1TV5urWNvPJte9++352iujpF0BmARRypOsfaqm0w3UvKS UsCl15KpDsBlvJe1M6690fcrM5e04jUfkJLE2H9/y0FE9mVifiXmbJgc/BQIhB10OLXb 0zfSM72ekmLfXQdsSq4SBy31+oo/DXCQmwTLbgeKZhMJQGUEMDG3kp+KBeZBye+MsLpA m0+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=yjqikO2xZnf8ucMbhiNDosvmpF8CpZ99dwiR19s71+8=; b=n6po2wb9ZsCI40vIGQibPie3JY4rDHue+ntlNAivhgi93HP6h+p2hbTJT/7tlWdfPy M+SIHM0gfHMj+eneGyKnqFFN61mjTBz2s9+fypXe5VkhLxs6sf5y5coBqDt5xKF+i+5q 6jV0hwRu5oAC8IQztyFjKLTM0l1GbjISGVQgLmdNxHNgGYMjFOxFsm1sqJyEOTLBUpmO rqcrdOH1+8SVHLZgeBFFMKP8WVH6LiFyoLffdaj+Pg8zVQTMGfn1vOboaSm6L2rfdan+ iTjQ364KxzonlF+o9C/5H8v4ZW5O4NPD74OSXGBr44fC7mTyC8WTMZajk2U93g6S2xnb S36A== X-Gm-Message-State: AMCzsaVa1y3rdpLyyZx1kzXqFSuzZzj+J8guU9fcmdf56wFD5gIYlHL5 Z7XrE2OcoFPs7duTYI4hXVtrgddfy5bEAC4HtUDZJA== X-Google-Smtp-Source: ABhQp+Q4yvp5zrKdXKPSwljyBVlH/qbWoZ5/15imbeCS79JsmsuoQOx8YSENhdGB1o4Wc3fKbRgRVzFlj345+ocTi5g= X-Received: by 10.55.15.139 with SMTP id 11mr14836137qkp.141.1508683841985; Sun, 22 Oct 2017 07:50:41 -0700 (PDT) MIME-Version: 1.0 Received: by 10.237.51.167 with HTTP; Sun, 22 Oct 2017 07:50:41 -0700 (PDT) In-Reply-To: <316ecd86-a508-fb36-e33c-ba32f5cb8073@selasky.org> References: <201710221342.v9MDguCC074682@repo.freebsd.org> <316ecd86-a508-fb36-e33c-ba32f5cb8073@selasky.org> From: Mateusz Guzik Date: Sun, 22 Oct 2017 16:50:41 +0200 Message-ID: Subject: Re: svn commit: r324863 - in head/sys: kern sys To: Hans Petter Selasky Cc: Mateusz Guzik , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Oct 2017 14:50:43 -0000 On Sun, Oct 22, 2017 at 04:24:41PM +0200, Hans Petter Selasky wrote: > On 10/22/17 15:42, Mateusz Guzik wrote: > > Author: mjg > > Date: Sun Oct 22 13:42:56 2017 > > New Revision: 324863 > > URL: https://svnweb.freebsd.org/changeset/base/324863 > > > > Log: > > Change kdb_active type to u_char. > > Fixes warnings from gcc and keeps the small size. Perhaps nesting should be moved > > to another variablle. > > Reported by: ngie > > > > Modified: > > head/sys/kern/subr_kdb.c > > head/sys/sys/kdb.h > > > > Modified: head/sys/kern/subr_kdb.c > > ============================================================================== > > --- head/sys/kern/subr_kdb.c Sun Oct 22 12:12:52 2017 (r324862) > > +++ head/sys/kern/subr_kdb.c Sun Oct 22 13:42:56 2017 (r324863) > > @@ -50,7 +50,7 @@ __FBSDID("$FreeBSD$"); > > #include > > #endif > > -bool __read_frequently kdb_active = 0; > > +u_char __read_frequently kdb_active = 0; > > static void *kdb_jmpbufp = NULL; > > struct kdb_dbbe *kdb_dbbe = NULL; > > static struct pcb kdb_pcb; > > > > Modified: head/sys/sys/kdb.h > > ============================================================================== > > --- head/sys/sys/kdb.h Sun Oct 22 12:12:52 2017 (r324862) > > +++ head/sys/sys/kdb.h Sun Oct 22 13:42:56 2017 (r324863) > > @@ -59,7 +59,7 @@ struct kdb_dbbe { > > }; \ > > DATA_SET(kdb_dbbe_set, name##_dbbe) > > -extern bool kdb_active; /* Non-zero while in debugger. */ > > +extern u_char kdb_active; /* Non-zero while in debugger. */ > > extern int debugger_on_panic; /* enter the debugger on panic. */ > > extern struct kdb_dbbe *kdb_dbbe; /* Default debugger backend or NULL. */ > > extern struct trapframe *kdb_frame; /* Frame to kdb_trap(). */ > > > > > > Should we add __aligned(8) to this definition? > > ./systm.h:#define __read_frequently __section(".data.read_frequently") > > It will prevent commonly read variables from residing in two different > cache-lines on x86 and amd64 at least??? > I don't follow. This would *increase* alignemnt requirement and in particular prevent bool variables from being put in consecutive bytes. To answer the question from your other e-mail, the bigger the type the worse it is as it takes more space. The idea is to change all frequently read and effectively bool variables from int to bool so that more of them fit in one cacheline. Right now there is nothing to nicely sort them to get rid of holes, but I'm tinkering with automagic size addition to section name. -- Mateusz Guzik