From owner-dev-commits-src-all@freebsd.org Mon Jan 18 21:48:57 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6B24A4F6A61; Mon, 18 Jan 2021 21:48:57 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKQQx0lCJz3J08; Mon, 18 Jan 2021 21:48:56 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.16.1/8.16.1) with ESMTPS id 10ILmnqm055696 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Mon, 18 Jan 2021 23:48:52 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 10ILmnqm055696 Received: (from kostik@localhost) by tom.home (8.16.1/8.16.1/Submit) id 10ILmnDk055695; Mon, 18 Jan 2021 23:48:49 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Mon, 18 Jan 2021 23:48:49 +0200 From: Konstantin Belousov To: Jessica Clarke Cc: "Alexander V. Chernikov" , "src-committers@FreeBSD.org" , "dev-commits-src-all@FreeBSD.org" , "dev-commits-src-main@FreeBSD.org" Subject: Re: git: 3b15beb30b3b - main - Implement malloc_domainset_aligned(9). Message-ID: References: <202101171729.10HHTsHk099908@gitrepo.freebsd.org> <124361611001207@mail.yandex.ru> <3B09F5B7-25CF-4E1F-8516-9226CB0A5B0E@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3B09F5B7-25CF-4E1F-8516-9226CB0A5B0E@freebsd.org> X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on tom.home X-Rspamd-Queue-Id: 4DKQQx0lCJz3J08 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jan 2021 21:48:57 -0000 On Mon, Jan 18, 2021 at 09:34:10PM +0000, Jessica Clarke wrote: > On 18 Jan 2021, at 21:19, Konstantin Belousov wrote: > > On Mon, Jan 18, 2021 at 08:45:43PM +0000, Alexander V. Chernikov wrote: > >> 17.01.2021, 17:30, "Konstantin Belousov" : > >>> The branch main has been updated by kib: > >>> > >>> URL: https://cgit.FreeBSD.org/src/commit/?id=3b15beb30b3b4ba17bae3d1d43c8c04ff862bb57 > >>> > >>> commit 3b15beb30b3b4ba17bae3d1d43c8c04ff862bb57 > >>> Author: Konstantin Belousov > >>> AuthorDate: 2021-01-14 03:59:34 +0000 > >>> Commit: Konstantin Belousov > >>> 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.