Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 18 Jan 2021 23:48:49 +0200
From:      Konstantin Belousov <kostikbel@gmail.com>
To:        Jessica Clarke <jrtc27@freebsd.org>
Cc:        "Alexander V. Chernikov" <melifaro@ipfw.ru>, "src-committers@FreeBSD.org" <src-committers@freebsd.org>, "dev-commits-src-all@FreeBSD.org" <dev-commits-src-all@freebsd.org>, "dev-commits-src-main@FreeBSD.org" <dev-commits-src-main@freebsd.org>
Subject:   Re: git: 3b15beb30b3b - main - Implement malloc_domainset_aligned(9).
Message-ID:  <YAYCQdzNL498PGrJ@kib.kiev.ua>
In-Reply-To: <3B09F5B7-25CF-4E1F-8516-9226CB0A5B0E@freebsd.org>
References:  <202101171729.10HHTsHk099908@gitrepo.freebsd.org> <124361611001207@mail.yandex.ru> <YAX7bvKGJDLqGz2B@kib.kiev.ua> <3B09F5B7-25CF-4E1F-8516-9226CB0A5B0E@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Jan 18, 2021 at 09:34:10PM +0000, Jessica Clarke wrote:
> On 18 Jan 2021, at 21:19, Konstantin Belousov <kostikbel@gmail.com> wrote:
> > On Mon, Jan 18, 2021 at 08:45:43PM +0000, Alexander V. Chernikov wrote:
> >> 17.01.2021, 17:30, "Konstantin Belousov" <kib@freebsd.org>:
> >>> The branch main has been updated by kib:
> >>> 
> >>> URL: https://cgit.FreeBSD.org/src/commit/?id=3b15beb30b3b4ba17bae3d1d43c8c04ff862bb57
> >>> 
> >>> commit 3b15beb30b3b4ba17bae3d1d43c8c04ff862bb57
> >>> Author: Konstantin Belousov <kib@FreeBSD.org>
> >>> AuthorDate: 2021-01-14 03:59:34 +0000
> >>> Commit: Konstantin Belousov <kib@FreeBSD.org>
> >>> CommitDate: 2021-01-17 17:29:05 +0000
> >>> 
> >>>     Implement malloc_domainset_aligned(9).
> >> Hi Kostik,
> >> 
> >> This change makes my vm panic in usb code. No dump, as dumpdev not mounted yet.
> >> 
> >> Note: the below lines have been OCR'ed, so there may be some errors.
> >> 
> >> Root mount waiting for: CAM usbus0 usbus1
> >> panic: malloc_domainset_aligned: result not aligned 0xfffff8000551ca80 size 0x180 align 0x100
> > 
> > Try this.
> > 
> > ...
> > 	if (size < align)
> > -		size = align;
> > -	res = malloc_domainset(size, mtp, ds, flags);
> > +		asize = align;
> > +	else if (!powerof2(size))
> > +		asize = roundup2(size, align);
> > +	else
> > +		asize = size;
> 
> Why not just `asize = roundup2(size, align)`? It's only 3 instructions
> (4 on Clang due to a missed combine) on amd64 and I'd be very surprised
> if the branching version were faster even in the fast path case. Plus
> it's much easier to read; currently it looks like there's something
> unusual going on but there really isn't.
> 
> https://godbolt.org/z/rv6qs7 FWIW

Ok, it is D28219.  Feel free to stamp.



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