From nobody Sat Jan 22 19:36:30 2022 X-Original-To: dev-commits-src-branches@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 51CC1196B7F6; Sat, 22 Jan 2022 19:36:36 +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 4Jh61r5Vw9z3RKF; Sat, 22 Jan 2022 19:36:32 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1642880194; 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=fC+/d5NF1IMgPme3K/0d7dqcFRh9kSX+ioiwuYNabtA=; b=AZMiiW+OpVvY2iGxHG56OkHxIUk0LiIxieBdvd3bQVU2p95gVlmf1RV64qgvlOq43Qmjcb /XaBTTsMtHnEJoHJ403ROZ5RgRfSad6IOSkT75lWcIU5L2kZ20Id50nFCzB5NpeFOEH+RY BePo00TfgrW1jnyudZuFIb/BZDSZNMC6Z+J1Qj/TVHaLKb9RFrKO17LOX+P9Ej9lqfCpCg WhSzBUVkoN+B1nr/Gjr2kIw1EZbhDHeiiCGrxpBXhrWBg25D9xwjPLlwyfjlaYtNnH/+Ro D+qD0K3ZMoqbLmqqvYol/DrqWiKO9SviyB42abGOkoVEUkKM7nnNTgIcAHAzYQ== 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 BD07414EC1; Sat, 22 Jan 2022 19:36:30 +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 20MJaULD000219; Sat, 22 Jan 2022 19:36:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 20MJaUga000218; Sat, 22 Jan 2022 19:36:30 GMT (envelope-from git) Date: Sat, 22 Jan 2022 19:36:30 GMT Message-Id: <202201221936.20MJaUga000218@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Vladimir Kondratyev Subject: git: a692caea30d0 - stable/13 - LinuxKPI: Move kfree_async() functionality in to kfree() List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: a692caea30d08c0627d4ee924589f625efbefd73 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1642880195; 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=fC+/d5NF1IMgPme3K/0d7dqcFRh9kSX+ioiwuYNabtA=; b=SIzp8N1j7QxVXL0rOqX6LytgdGWGoxrFheVSadRHgJphvK96rubHtacFpUc6pPxaZoKfKK 9AxFFDbW04znTGgM5e3Kv9jbeM4kAoGBiBMjDN4Hu0L42o0FPUavcT5HCHPWnW1ofmH5HK BhUhz/k6ntQnoBip27gsQOTKGCQxwSMb03h7zj+5ZUlObfv3gDmQaTuNBbW3rYCFBKdJZK RTqK64LdeycO4LSfzhgB60o/qKyB1fq9337p/SRmXMkgoMUryiQArN9cqG4wKkzdXWHMCr mulhk0ql5K2xyeCBCRuqai+5evqU3Pi45n4NIJS4DWLyzQQNbHrgGndO1/cJAA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1642880195; a=rsa-sha256; cv=none; b=swh/Y4pkab5QYPkxk+9Dk1QxIXbSe8U8GjijCpFERLUaOndB6n/OZVL3oiqIZ5mi38KfAS lLVcX96CnRSQRPKWbs1tsb7/5EekPSlmFB0dQ8lp29glVa80SUyMyn0u0Ft3HLshF5ylpj N46TKyn5IaAC123EwiP4pbDNu8Hj95P6OjO+IqyNemL80RRVPJKNGZGWkOMK0T0feIDIfp LASbyPLIUzeTJdJFq1Mzlx3913KnrmapVmN8dPuKvnMQAqCPac0I1qAWf7Jp500VPfo+gr AdMm9f51ejDRjKTRmJ5SFrfjAT1ijWnAKfWoydkhYL+CG1vR0fBwwAxFTFjl4A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=a692caea30d08c0627d4ee924589f625efbefd73 commit a692caea30d08c0627d4ee924589f625efbefd73 Author: Vladimir Kondratyev AuthorDate: 2021-11-15 13:53:02 +0000 Commit: Vladimir Kondratyev CommitDate: 2022-01-22 19:34:37 +0000 LinuxKPI: Move kfree_async() functionality in to kfree() Obsolete it usage but keep for a while for drm-kmod 5.4 compatibility MFC after: 1 week Reviewed by: hselasky, manu Differential Revision: https://reviews.freebsd.org/D33298 (cherry picked from commit 0b1244bd79c2c4da25278a2e25a2471d9edd9408) --- sys/compat/linuxkpi/common/include/linux/slab.h | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/linux/slab.h b/sys/compat/linuxkpi/common/include/linux/slab.h index e29dd064ff23..f7cad5f6b4cb 100644 --- a/sys/compat/linuxkpi/common/include/linux/slab.h +++ b/sys/compat/linuxkpi/common/include/linux/slab.h @@ -86,18 +86,8 @@ struct linux_kmem_cache; #define ARCH_KMALLOC_MINALIGN \ __alignof(unsigned long long) -/* - * Critical section-friendly version of kfree(). - * Requires knowledge of the allocation size at build time. - */ -#define kfree_async(ptr) do { \ - _Static_assert(sizeof(*(ptr)) >= sizeof(struct llist_node), \ - "Size of object to free is unknown or too small"); \ - if (curthread->td_critnest != 0) \ - linux_kfree_async(ptr); \ - else \ - kfree(ptr); \ -} while (0) +/* drm-kmod 5.4 compat */ +#define kfree_async(ptr) kfree(ptr); static inline gfp_t linux_check_m_flags(gfp_t flags) @@ -117,7 +107,8 @@ linux_check_m_flags(gfp_t flags) static inline void * kmalloc(size_t size, gfp_t flags) { - return (malloc(size, M_KMALLOC, linux_check_m_flags(flags))); + return (malloc(MAX(size, sizeof(struct llist_node)), M_KMALLOC, + linux_check_m_flags(flags))); } static inline void * @@ -186,10 +177,15 @@ krealloc(void *ptr, size_t size, gfp_t flags) return (realloc(ptr, size, M_KMALLOC, linux_check_m_flags(flags))); } +extern void linux_kfree_async(void *); + static inline void kfree(const void *ptr) { - free(__DECONST(void *, ptr), M_KMALLOC); + if (curthread->td_critnest != 0) + linux_kfree_async(__DECONST(void *, ptr)); + else + free(__DECONST(void *, ptr), M_KMALLOC); } static __inline void @@ -210,7 +206,6 @@ extern void *lkpi_kmem_cache_alloc(struct linux_kmem_cache *, gfp_t); extern void *lkpi_kmem_cache_zalloc(struct linux_kmem_cache *, gfp_t); extern void lkpi_kmem_cache_free(struct linux_kmem_cache *, void *); extern void linux_kmem_cache_destroy(struct linux_kmem_cache *); -void linux_kfree_async(void *); void linux_kmem_cache_free_rcu_callback(struct rcu_head *head); void linux_kmem_cache_free_rcu(struct linux_kmem_cache *, void *);