From owner-freebsd-hackers@freebsd.org Tue Oct 11 16:06:55 2016 Return-Path: Delivered-To: freebsd-hackers@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 2DB6DC0D3F7 for ; Tue, 11 Oct 2016 16:06:55 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9D3F6B0C for ; Tue, 11 Oct 2016 16:06:54 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id u9BG6lC9041927 (version=TLSv1 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Tue, 11 Oct 2016 19:06:48 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua u9BG6lC9041927 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id u9BG6kfk041926; Tue, 11 Oct 2016 19:06:46 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 11 Oct 2016 19:06:46 +0300 From: Konstantin Belousov To: Peter Jeremy Cc: Norbert Koch , freebsd-hackers@freebsd.org Subject: Re: Why at least 4 cylinder groups? Message-ID: <20161011160646.GT68202@kib.kiev.ua> References: <201610101526.u9AFQNuH091581@pdx.rh.CN85.dnsmgr.net> <24c7ca75-d50d-a7d2-933b-15ce4cf04b94@demig.de> <20161011071409.GL76775@server.rulingia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20161011071409.GL76775@server.rulingia.com> User-Agent: Mutt/1.7.0 (2016-08-17) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Oct 2016 16:06:55 -0000 On Tue, Oct 11, 2016 at 06:14:09PM +1100, Peter Jeremy wrote: > On 2016-Oct-11 08:50:44 +0200, Norbert Koch wrote: > >Am 2016-10-10 um 17:26 schrieb Rodney W. Grimes: > >>> In an embedded system I am having a rather > >>> small (static) ram disk of about 1.5MB, > >>> formatted as UFS(1). > > ufs2 is designed to work around some space limitations in ufs1 and so > needs more space. If you're space-limited, ufs1 is probably a better choice. > > >>> Is there any technical reason not to have less > >>> than 4 cylinder groups? > >> Probably on a UFS2 file system yes, but as far as I can > >> see not on a UFS1 file system. > >> > >>> For my application the wasted 188KB make a difference. > ... > >So, afaics technically one cylinder group would be ok for UFS1, right? > > The reasons for multiple CGs are: > 1) Improve performance by limiting the seek distance to a CG. > 2) Provide redundant superblocks to protect against bad blocks. > Neither of these reasons apply to a ramdisk. > > If you're keen to maximise data space, you might like to also reduce > ipg (increase '-i'). I am not aware of the reason why MINCYLGRPS exists at all. If your goal is reducing the memory consumption for the kernel and metadata overhead with the fixed amount of data to access, you may consider using tmpfs. The additional kernel text size is tiny 50K, comparing with the 1.5M disk size. If you mmap(2) the data from the ramdisk, then you will save the amount of memory twice the size of your mmaped data. tmpfs allows to set limits on mount, so you can have safety belts as well. The recommendation is valid if you use stable/10, 11 or HEAD.