svn commit: r330853 - in stable/11/sys/compat/linuxkpi/common: include/linux src

Hans Petter Selasky hselasky at FreeBSD.org
Tue Mar 13 16:21:00 UTC 2018


Author: hselasky
Date: Tue Mar 13 16:20:59 2018
New Revision: 330853
URL: https://svnweb.freebsd.org/changeset/base/330853

Log:
  MFC r330387 and r330396:
  Rename the SLAB_DESTROY_BY_RCU flag into SLAB_TYPESAFE_BY_RCU in the LinuxKPI
  to be compatible with Linux.
  
  Keep the old SLAB_DESTROY_BY_RCU macro definition around in the LinuxKPI
  to avoid compilation breakage in external kernel modules.
  
  Requested by:	Johannes Lundberg <johalun0 at gmail.com>
  Sponsored by:	Mellanox Technologies

Modified:
  stable/11/sys/compat/linuxkpi/common/include/linux/slab.h
  stable/11/sys/compat/linuxkpi/common/src/linux_slab.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/compat/linuxkpi/common/include/linux/slab.h
==============================================================================
--- stable/11/sys/compat/linuxkpi/common/include/linux/slab.h	Tue Mar 13 16:18:38 2018	(r330852)
+++ stable/11/sys/compat/linuxkpi/common/include/linux/slab.h	Tue Mar 13 16:20:59 2018	(r330853)
@@ -79,9 +79,12 @@ struct linux_kmem_cache {
 };
 
 #define	SLAB_HWCACHE_ALIGN	(1 << 0)
-#define	SLAB_DESTROY_BY_RCU     (1 << 1)
+#define	SLAB_TYPESAFE_BY_RCU    (1 << 1)
 #define	SLAB_RECLAIM_ACCOUNT	(1 << 2)
 
+#define	SLAB_DESTROY_BY_RCU \
+	SLAB_TYPESAFE_BY_RCU
+
 static inline gfp_t
 linux_check_m_flags(gfp_t flags)
 {
@@ -162,7 +165,7 @@ extern void linux_kmem_cache_free_rcu(struct linux_kme
 static inline void
 linux_kmem_cache_free(struct linux_kmem_cache *c, void *m)
 {
-	if (unlikely(c->cache_flags & SLAB_DESTROY_BY_RCU))
+	if (unlikely(c->cache_flags & SLAB_TYPESAFE_BY_RCU))
 		linux_kmem_cache_free_rcu(c, m);
 	else
 		uma_zfree(c->cache_zone, m);

Modified: stable/11/sys/compat/linuxkpi/common/src/linux_slab.c
==============================================================================
--- stable/11/sys/compat/linuxkpi/common/src/linux_slab.c	Tue Mar 13 16:18:38 2018	(r330852)
+++ stable/11/sys/compat/linuxkpi/common/src/linux_slab.c	Tue Mar 13 16:20:59 2018	(r330853)
@@ -49,7 +49,7 @@ linux_kmem_ctor(void *mem, int size, void *arg, int fl
 {
 	struct linux_kmem_cache *c = arg;
 
-	if (unlikely(c->cache_flags & SLAB_DESTROY_BY_RCU)) {
+	if (unlikely(c->cache_flags & SLAB_TYPESAFE_BY_RCU)) {
 		struct linux_kmem_rcu *rcu = LINUX_KMEM_TO_RCU(c, mem);
 
 		/* duplicate cache pointer */
@@ -85,7 +85,7 @@ linux_kmem_cache_create(const char *name, size_t size,
 	else if (align != 0)
 		align--;
 
-	if (flags & SLAB_DESTROY_BY_RCU) {
+	if (flags & SLAB_TYPESAFE_BY_RCU) {
 		/* make room for RCU structure */
 		size = ALIGN(size, sizeof(void *));
 		size += sizeof(struct linux_kmem_rcu);
@@ -118,7 +118,7 @@ linux_kmem_cache_free_rcu(struct linux_kmem_cache *c, 
 void
 linux_kmem_cache_destroy(struct linux_kmem_cache *c)
 {
-	if (unlikely(c->cache_flags & SLAB_DESTROY_BY_RCU)) {
+	if (unlikely(c->cache_flags & SLAB_TYPESAFE_BY_RCU)) {
 		/* make sure all free callbacks have been called */
 		rcu_barrier();
 	}


More information about the svn-src-all mailing list