From nobody Tue Mar 29 11:18:59 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 9DD9B1A377F7; Tue, 29 Mar 2022 11:18:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (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-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4KSRsH3t13z4ZpQ; Tue, 29 Mar 2022 11:18:59 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1648552739; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=SJdtnarDnaqsc9NBOGgImRyscqPn/MkPmTpVJV2oju8=; b=btP7MZpyAOf6oOj0aZa9Tyd/J55LlRJmwgRflQpuxZw9gMeYFbYqxJln1yVGdpIExRM6ZB iIUAI8iij+7+ZZGGwLwOJgm251VuP8icAi7B38qJs4BIpwY3bfO8mSOtSf+ttDYyAllZCg BpLQqOXdkyL9LDyEAkB+gVC7ciLwzstyCOTQBnEAMJQ32QO12S6EPr54RCj2Kb8ojLSx06 4aY1p4IOUHc+RwdVY3Z3tIOV4fDTpUmNYoSk2RM8eup2Uxvl3opWGUJBaNcXuBLp2VnnC9 UfNX9wG97tVbyEjUGzKUrvKKeGD6SkJBOST8xPcs5nsaBdxX5jeh5qiZ7Mjalg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6172A1D831; Tue, 29 Mar 2022 11:18:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 22TBIxCY092707; Tue, 29 Mar 2022 11:18:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 22TBIx5G092706; Tue, 29 Mar 2022 11:18:59 GMT (envelope-from git) Date: Tue, 29 Mar 2022 11:18:59 GMT Message-Id: <202203291118.22TBIx5G092706@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: 40c911e8da50 - main - zfs: use zero_region instead of allocating a dedicated page List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 40c911e8da50e5a67356506c4e748b6b98969ee8 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1648552739; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=SJdtnarDnaqsc9NBOGgImRyscqPn/MkPmTpVJV2oju8=; b=EoZPvbXLq6Uil5Z+oBeiIcXTpCiqyoi5G/SvIsp/AupHfy45/Pb63pieLIUsqUJayaXYTN up1IYb5O00GW9I1RYbsf8FV9cKsjjaj2Ij3YVY9rEJ8jvT6vapqXMjZFMLfgaGNZlmt7lg upMMVu/6y4yepGWC1Eihlr38dokDO11zERQOtKinC5gHlOrnspOMOHJsIIzE4sgnal55Z1 ZKukg/9G23xj0Ex19XZW9BP/KTXM3N047315tTBgw2jYWd3F38wwZk89tjltA1lqfBfb2j AdtlxFiGFyEuV4t8E6vZNWZkr+QCKSaqlD//feI3rcOlv9VAP/QxBXz5uFykrw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1648552739; a=rsa-sha256; cv=none; b=VekZSTl14o5Km7mJ7CRZ/ITtSO7Um0snF8Rin22XjjM0Tu95zMndVtj3rIlbla4AoFe3Qz QocTFQCNdvsos8VGcfxnm9+n7WElxcKs69LDF4/+fWW8qOTjXN51NcNVZ6UzNHTaMt8xMI rfPbhIiQGM+ElFLe+4JyYr3uIP1zolncoGrkDqx1VO4/YvJX5AUsJqxGTmOYBuJKlB8dMq wUvQfLArx2Nf/M0rpO3YJjk7PkZiVcZQ2xNG5yPhvLoomwAZuPE3i7IA8R8Cm1yMCkAbmf 6MMdUMgfz5CdJRLyWiUip+TZNkLHuflCQfeovdYSNGfsH+PcqBIam01C8fGCmQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=40c911e8da50e5a67356506c4e748b6b98969ee8 commit 40c911e8da50e5a67356506c4e748b6b98969ee8 Author: Mateusz Guzik AuthorDate: 2022-03-29 11:05:56 +0000 Commit: Mateusz Guzik CommitDate: 2022-03-29 11:18:55 +0000 zfs: use zero_region instead of allocating a dedicated page --- sys/contrib/openzfs/module/os/freebsd/zfs/abd_os.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/sys/contrib/openzfs/module/os/freebsd/zfs/abd_os.c b/sys/contrib/openzfs/module/os/freebsd/zfs/abd_os.c index 5d2bae5cfeb4..58a37df62b69 100644 --- a/sys/contrib/openzfs/module/os/freebsd/zfs/abd_os.c +++ b/sys/contrib/openzfs/module/os/freebsd/zfs/abd_os.c @@ -113,7 +113,6 @@ static kstat_t *abd_ksp; * memory by only using a single zero buffer for the scatter chunks. */ abd_t *abd_zero_scatter = NULL; -static char *abd_zero_buf = NULL; static uint_t abd_chunkcnt_for_bytes(size_t size) @@ -241,18 +240,16 @@ abd_free_struct_impl(abd_t *abd) /* * Allocate scatter ABD of size SPA_MAXBLOCKSIZE, where - * each chunk in the scatterlist will be set to abd_zero_buf. + * each chunk in the scatterlist will be set to the same area. */ +_Static_assert(ZERO_REGION_SIZE >= PAGE_SIZE, "zero_region too small"); static void abd_alloc_zero_scatter(void) { uint_t i, n; n = abd_chunkcnt_for_bytes(SPA_MAXBLOCKSIZE); - abd_zero_buf = kmem_cache_alloc(abd_chunk_cache, KM_PUSHPAGE); - memset(abd_zero_buf, 0, PAGE_SIZE); abd_zero_scatter = abd_alloc_struct(SPA_MAXBLOCKSIZE); - abd_zero_scatter->abd_flags |= ABD_FLAG_OWNER | ABD_FLAG_ZEROS; abd_zero_scatter->abd_size = SPA_MAXBLOCKSIZE; @@ -260,7 +257,7 @@ abd_alloc_zero_scatter(void) for (i = 0; i < n; i++) { ABD_SCATTER(abd_zero_scatter).abd_chunks[i] = - abd_zero_buf; + __DECONST(void *, zero_region); } ABDSTAT_BUMP(abdstat_scatter_cnt); @@ -275,7 +272,6 @@ abd_free_zero_scatter(void) abd_free_struct(abd_zero_scatter); abd_zero_scatter = NULL; - kmem_cache_free(abd_chunk_cache, abd_zero_buf); } static int