mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00
mm: zswap: function ordering: move entry section out of tree section
The higher-level entry operations modify the tree, so move the entry API after the tree section. Link: https://lkml.kernel.org/r/20240130014208.565554-17-hannes@cmpxchg.org Signed-off-by: Johannes Weiner <hannes@cmpxchg.org> Reviewed-by: Nhat Pham <nphamcs@gmail.com> Cc: Chengming Zhou <zhouchengming@bytedance.com> Cc: Yosry Ahmed <yosryahmed@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
parent
5182661a11
commit
36034bf6fc
1 changed files with 21 additions and 21 deletions
42
mm/zswap.c
42
mm/zswap.c
|
@ -848,27 +848,6 @@ void zswap_memcg_offline_cleanup(struct mem_cgroup *memcg)
|
|||
spin_unlock(&zswap_pools_lock);
|
||||
}
|
||||
|
||||
/*********************************
|
||||
* zswap entry functions
|
||||
**********************************/
|
||||
static struct kmem_cache *zswap_entry_cache;
|
||||
|
||||
static struct zswap_entry *zswap_entry_cache_alloc(gfp_t gfp, int nid)
|
||||
{
|
||||
struct zswap_entry *entry;
|
||||
entry = kmem_cache_alloc_node(zswap_entry_cache, gfp, nid);
|
||||
if (!entry)
|
||||
return NULL;
|
||||
entry->refcount = 1;
|
||||
RB_CLEAR_NODE(&entry->rbnode);
|
||||
return entry;
|
||||
}
|
||||
|
||||
static void zswap_entry_cache_free(struct zswap_entry *entry)
|
||||
{
|
||||
kmem_cache_free(zswap_entry_cache, entry);
|
||||
}
|
||||
|
||||
/*********************************
|
||||
* rbtree functions
|
||||
**********************************/
|
||||
|
@ -930,6 +909,27 @@ static bool zswap_rb_erase(struct rb_root *root, struct zswap_entry *entry)
|
|||
return false;
|
||||
}
|
||||
|
||||
/*********************************
|
||||
* zswap entry functions
|
||||
**********************************/
|
||||
static struct kmem_cache *zswap_entry_cache;
|
||||
|
||||
static struct zswap_entry *zswap_entry_cache_alloc(gfp_t gfp, int nid)
|
||||
{
|
||||
struct zswap_entry *entry;
|
||||
entry = kmem_cache_alloc_node(zswap_entry_cache, gfp, nid);
|
||||
if (!entry)
|
||||
return NULL;
|
||||
entry->refcount = 1;
|
||||
RB_CLEAR_NODE(&entry->rbnode);
|
||||
return entry;
|
||||
}
|
||||
|
||||
static void zswap_entry_cache_free(struct zswap_entry *entry)
|
||||
{
|
||||
kmem_cache_free(zswap_entry_cache, entry);
|
||||
}
|
||||
|
||||
static struct zpool *zswap_find_zpool(struct zswap_entry *entry)
|
||||
{
|
||||
int i = 0;
|
||||
|
|
Loading…
Add table
Reference in a new issue