From nobody Thu Nov 02 13:40:06 2023 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 4SLlP23zKTz50LxR; Thu, 2 Nov 2023 13:40:06 +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 4SLlP23Slmz4PC7; Thu, 2 Nov 2023 13:40:06 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1698932406; 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=pZ4HbVqlcgxF3WRu46b7G6pzMw0MPfArIEXq5amZMUg=; b=StQOQw5xU+40D0i+x2ywGtudUUreV8G4zVOX0dPuTpL7g+7F4xwyjTJXVmB8QurjHzc5KE uN87mbHQOPSi0KMmmX1W/HNUglVhFDKgs/W6BC2gg5jdHCd3dI+/pRNDec68GpZIAuE5mf CjnMTz1cQKgoyIi1ZRwp0aUjzkv6OYECnNsgyxko+r2ZSDr5b++DAdl0oFazGcR/QX9rq4 QhZEMot144+TRmYynPJcLWBsMiR5L/SAopXMpzbUGdrzPIvnK+yJss+y9bWQJLkA7b5Wyf CHyFtf+VsuYoAyro9mlTZ8EFDdRAX+LUwly/GcqwJOO3UeUxAZ0POTJTO0j+Ww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1698932406; 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=pZ4HbVqlcgxF3WRu46b7G6pzMw0MPfArIEXq5amZMUg=; b=sOelPRXOV7q6zU2rJa9lj7Hp8npZjtdn9G86zJtFSB+F75SZ6aAcUcB8dureLbeHuOGMQ0 nd2mQm4/paZkSd7lq5nHtRCA89XjQwBPX2+I/Kk58eXWHE7md2xgzda+i2VAGyibUDy1u0 pZ+JI+ZHSiJ3u/dSzBQGD6hjJVaw/KzU7xnt/HJZ1tN4CrRlC4Kq0T1WRT65Yom1635rhS w4iq+uDAzi705j1wIiD+Rdmqgy0mtiUAEesdGHKFIJ372w6H2OSoMinLmqoILPHCAv22v7 Ke7ghKGgzV0e3KhjVwz9Eg6ys197+NFAE9YGHaaI2I2C/laRE14wpL63k1nj2A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1698932406; a=rsa-sha256; cv=none; b=H1PTu38EKkAGydmItZXj6gPXYu7mOTdhTJqSo+EKd6Fb7BrepGDQAg7Hxodv6JObnfZPKC w7dGUTIwk4R8JOmyW36CSVRXn7oRAuhnAQcX1K5xcEYA+qxU2HFHNdVJ90iW/rkh0I72o5 ZxgUecZiHyFu6kmFvQF7fI8JMxT9WQ27PeTbiKtOsckiMDu8GxjhpTOsFIzQnzOTzNtDRB hdj3dhiuLYciXSZVDiHW5JGliRaeN9/nuonqoiYn/2sYGde+PUqUuiho3M/HuT+QK0q0Op dQz5sVfvJZbjPLOUMDhrJ+qwTZCchJPJcsYDnEREmnYs/1ZFzCod+cH7FTIEqA== 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 4SLlP22V0DzX1r; Thu, 2 Nov 2023 13:40:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3A2De6nj028202; Thu, 2 Nov 2023 13:40:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3A2De6gq028197; Thu, 2 Nov 2023 13:40:06 GMT (envelope-from git) Date: Thu, 2 Nov 2023 13:40:06 GMT Message-Id: <202311021340.3A2De6gq028197@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: e557eafe7233 - main - uma: UMA_ALIGN_CACHE: Resolve the proper value at use point 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: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e557eafe7233f8231c1f5f5b098e4bab8e818645 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=e557eafe7233f8231c1f5f5b098e4bab8e818645 commit e557eafe7233f8231c1f5f5b098e4bab8e818645 Author: Olivier Certner AuthorDate: 2023-10-13 12:13:30 +0000 Commit: Mark Johnston CommitDate: 2023-11-02 13:30:03 +0000 uma: UMA_ALIGN_CACHE: Resolve the proper value at use point Having a special value of -1 that is resolved internally to 'uma_align_cache' provides no significant advantages and prevents changing that variable to an unsigned type, which is natural for an alignment mask. So suppress it and replace its use with a call to uma_get_align_mask(). The small overhead of the added function call is irrelevant since UMA_ALIGN_CACHE is only used when creating new zones, which is not performance critical. Reviewed by: markj, kib MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D42259 --- sys/vm/uma.h | 2 +- sys/vm/uma_core.c | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/sys/vm/uma.h b/sys/vm/uma.h index 793f9af3dace..4bf23534ed27 100644 --- a/sys/vm/uma.h +++ b/sys/vm/uma.h @@ -301,7 +301,7 @@ uma_zone_t uma_zcache_create(const char *name, int size, uma_ctor ctor, #define UMA_ALIGN_INT (sizeof(int) - 1) /* "" int */ #define UMA_ALIGN_SHORT (sizeof(short) - 1) /* "" short */ #define UMA_ALIGN_CHAR (sizeof(char) - 1) /* "" char */ -#define UMA_ALIGN_CACHE (0 - 1) /* Cache line size align */ +#define UMA_ALIGN_CACHE (uma_get_cache_align_mask()) /* Cache line size align */ #define UMA_ALIGNOF(type) (_Alignof(type) - 1) /* Alignment fit for 'type' */ #define UMA_ANYDOMAIN -1 /* Special value for domain search. */ diff --git a/sys/vm/uma_core.c b/sys/vm/uma_core.c index 6e83a27bab27..b74fbd57e77f 100644 --- a/sys/vm/uma_core.c +++ b/sys/vm/uma_core.c @@ -3243,7 +3243,7 @@ uma_kcreate(uma_zone_t zone, size_t size, uma_init uminit, uma_fini fini, args.size = size; args.uminit = uminit; args.fini = fini; - args.align = (align == UMA_ALIGN_CACHE) ? uma_cache_align_mask : align; + args.align = align; args.flags = flags; args.zone = zone; return (zone_alloc_item(kegs, &args, UMA_ANYDOMAIN, M_WAITOK)); @@ -3256,7 +3256,6 @@ uma_set_cache_align_mask(int mask) { if (mask >= 0) - /* UMA_ALIGN_CACHE is also not permitted here. */ uma_cache_align_mask = mask; }