Fix cas_vfree

1. cas_vfree implementation is now properly selected based on kernel version
2. cas_vfree semantics now accepts NULL pionter as a valid input

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
This commit is contained in:
Adam Rutkowski 2019-10-18 17:28:04 -04:00
parent d2666b785a
commit f7cc3d414c

View File

@ -3,10 +3,12 @@
* SPDX-License-Identifier: BSD-3-Clause-Clear
*/
#include "cas_cache.h"
#include "utils_gc.h"
#include <linux/vmalloc.h>
#if defined (CAS_GARBAGE_COLLECTOR)
struct cas_vfree_item {
struct llist_head list;
struct work_struct ws;
@ -35,6 +37,9 @@ void cas_vfree(const void *addr)
{
struct cas_vfree_item *item = this_cpu_ptr(&cas_vfree_item);
if (!addr)
return;
atomic_inc(&freed);
if (llist_add((struct llist_node *)addr, &item->list))