From nobody Mon Jan 10 19:50:43 2022 X-Original-To: dev-commits-src-main@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 7BCFE19546E3; Mon, 10 Jan 2022 19:50:47 +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 4JXkvm5r7jz3P0t; Mon, 10 Jan 2022 19:50:44 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 C64AB32AC; Mon, 10 Jan 2022 19:50:43 +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 20AJohQf009127; Mon, 10 Jan 2022 19:50:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 20AJohSs009126; Mon, 10 Jan 2022 19:50:43 GMT (envelope-from git) Date: Mon, 10 Jan 2022 19:50:43 GMT Message-Id: <202201101950.20AJohSs009126@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: 0b1244bd79c2 - main - LinuxKPI: Move kfree_async() functionality in to kfree() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: 0b1244bd79c2c4da25278a2e25a2471d9edd9408 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1641844246; 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=fVAYDOaaZsOuyl1J01QrH2QIrnGWxv7qQgqTHYjm4fg=; b=M57mhaowOaw0LS30LU+Ubx6yZ7cbeMkZHjIJiJOye5pehINYsJx9k9fGP7EYy5WqsrFOUG PVGuxi8oa3lCChb9cZ5np/E8xcS31Fi1A7IKKvwoPi9iF2o8PDZQtTA9Pn4xSAOYXQVv7E vCcpDYFiUw3/cP0cOSnU+NbOLssYYejzrnLRQ7MuvB0mFRrqyiGIjoU1hQUcP1+5zR+XaH IRpI6Gz43IcDtbGRmlUSOFm8l9iGNnLJTCUMn3sS43uT5uMQX6n5U4moHRxki37zgkUsnt oIDC7IQJl5mly7fXr+sYX06TvQJuckp6vh7eljGHVYo0gX9gkxioRSW0WdnatQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1641844246; a=rsa-sha256; cv=none; b=aXaEabHsu9yWtxOJgnUCPuv1z9uziaS7cMeeVuEIRUh4EAODl+CmJtz1ESDLY9W5AgnkQY SB0nGQn91T+fgUlLEaIwJDIqgDTs3io9atD5INFASva7LApzf9wxe03zdsKGDLwPzO9juE ng/iWeNpKK2DtniloCI58feOp9p3O914i7+6gq2FEdy6UkwsCcIF07beprmxSOBnZbpLQz mQ5S0aF1Ow/fqr7ZXgM4Att/Ek2vYZI/2uTz3OpE3ZBf0AtZ8ThIBHxVNDh4UM4wVeIgag I4qPczka9ve8fVpX0MS/IQU6Nj0Agx5tbh0XqAlZptu8aektnm7FLxYdJbyAJw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=0b1244bd79c2c4da25278a2e25a2471d9edd9408 commit 0b1244bd79c2c4da25278a2e25a2471d9edd9408 Author: Vladimir Kondratyev AuthorDate: 2021-11-15 13:53:02 +0000 Commit: Vladimir Kondratyev CommitDate: 2022-01-10 19:49: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 --- 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 56bb08c185e2..b8fe3a48bd3c 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,6 +206,5 @@ 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 *); #endif /* _LINUX_SLAB_H_ */