From owner-freebsd-arch@freebsd.org Mon Nov 28 16:27:12 2016 Return-Path: Delivered-To: freebsd-arch@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 59411C5ACF5 for ; Mon, 28 Nov 2016 16:27:12 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-io0-x233.google.com (mail-io0-x233.google.com [IPv6:2607:f8b0:4001:c06::233]) (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 2410F1289 for ; Mon, 28 Nov 2016 16:27:12 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: by mail-io0-x233.google.com with SMTP id a124so238385531ioe.2 for ; Mon, 28 Nov 2016 08:27:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=sUK02J89jNKc2VNGMnVqXL7BVSm+wtvaK3MJOzU9mWc=; b=IQbYyJJbhWwTA+OcU3q8lLfSmsN2tmWZiJiCbqhikwZoKgV7bwDu3BJfJmL46Haq8h s/eJ4YbbGiQAl2FNk4N5/B4bslKPEVHadCmQgshWCtUJTBey7dYqK4Fd8kxXLSZGAeWl 37916StOUwSgMPsjGnHoNZ5QxxWgXBrtxYyyf/Gcqfi2Xa9D3aD+60zv/1l8+XGV+QT9 wODP4OmYmbSAFX+zSEmieVFDs2flSnuUipMkXQ78QFapaILc1yF27pN/EC5guZAh/4s0 Z77KU4R0aadK3fxB3AdbGNfxYUGoPQI5pWQ4z1Zd6oSKziswn7m+UJJW209sruL9x8z4 ROwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=sUK02J89jNKc2VNGMnVqXL7BVSm+wtvaK3MJOzU9mWc=; b=h1poNsV1Xrc8OoUb32pb5Wm85uhvrOf8HPHhxJ/E9lDlE9jxE2xbVDBtolxvOSivHm EFmGXa0ylaiRDeBwH0vBhPe0T1nEcQ9iu/nImGUi6XowUVzKgV95b+YJTmO0rBSonWlY SSboWEhs2cXQYn3bn6xaCbKB3iWKBa5XBgcxfXm4SqjVzrZPqbH+s/w3eTmAaR5Psu0+ gj8crhx14dVC98d6mDNANM2Rkn5BB0E9csP4OXUU+qfkEV3I6rR4qyuwKwi/3M/t733m z608ZtA5h07dhOSsprbCNsYXQYnZDMckwOAsrfYwxEVgRmJKiCeToKPNX6hfls5BM42U 9DcQ== X-Gm-Message-State: AKaTC00j1krDA9T+4JoUmEBUrTr0dxDraTt/EFkIsdlbtmtRkwaxGhwvkBj9BQFEqgiN8qKjuLXaExHOJUXG/w== X-Received: by 10.36.61.146 with SMTP id n140mr19263593itn.78.1480350431488; Mon, 28 Nov 2016 08:27:11 -0800 (PST) MIME-Version: 1.0 Received: by 10.36.39.134 with HTTP; Mon, 28 Nov 2016 08:27:10 -0800 (PST) In-Reply-To: References: <20161127212503.GA23218@dft-labs.eu> From: Adrian Chadd Date: Mon, 28 Nov 2016 08:27:10 -0800 Message-ID: Subject: Re: __read_only in the kernel To: Anton Yuzhaninov Cc: "freebsd-arch@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Nov 2016 16:27:12 -0000 .. and it makes it easy to see (a) whether a variable has it, and (b) whether a variable doesn't - just use grep. -a On 28 November 2016 at 07:16, Anton Yuzhaninov wrote: > On 11/28/16 03:30, Ed Schouten wrote: >> >> 2016-11-27 22:25 GMT+01:00 Mateusz Guzik : >>> >>> The somewhat standard way of combating parts of it for frequently read >>> and rarely (if ever) modified variables is an annotation which puts >>> them in a dedicated part of the binary and the somewhat standard name >>> for a macro doing the work is __read_mostly. >> >> >> Out of curiosity, what is the advantage of doing this? > > > If a variable which read often shares CPU cache line with a variable updated > often we have performance degradation. Each time second variable is updated > first (read mostly) unnecessary flushed from CPU cache. > > Some data structures already aligned by cache line size to avoid false > sharing, but moving read only / read mostly variables to separate section > allows to avoid false sharing without spending memory on alignment (and > alignment not always helps to avoid false sharing AFAIK). > > _______________________________________________ > freebsd-arch@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-arch > To unsubscribe, send any mail to "freebsd-arch-unsubscribe@freebsd.org"