Lines Matching +full:no +full:- +full:map

1 // SPDX-License-Identifier: GPL-2.0
10 struct page **map; member
28 * - we have no race in "exchange" when we're accessed via SwapCache because
30 * - When called via swap_free(), there is no user of this entry and no race.
47 for (idx = 0; idx < ctrl->length; idx++) { in swap_cgroup_prepare()
51 ctrl->map[idx] = page; in swap_cgroup_prepare()
60 __free_page(ctrl->map[idx]); in swap_cgroup_prepare()
62 return -ENOMEM; in swap_cgroup_prepare()
71 mappage = ctrl->map[offset / SC_PER_PAGE]; in __lookup_swap_cgroup()
89 * swap_cgroup_cmpxchg - cmpxchg mem_cgroup's id for this swp_entry.
95 * (There is no mem_cgroup using 0 as its id)
107 spin_lock_irqsave(&ctrl->lock, flags); in swap_cgroup_cmpxchg()
108 retval = sc->id; in swap_cgroup_cmpxchg()
110 sc->id = new; in swap_cgroup_cmpxchg()
113 spin_unlock_irqrestore(&ctrl->lock, flags); in swap_cgroup_cmpxchg()
118 * swap_cgroup_record - record mem_cgroup for a set of swap entries
138 spin_lock_irqsave(&ctrl->lock, flags); in swap_cgroup_record()
139 old = sc->id; in swap_cgroup_record()
141 VM_BUG_ON(sc->id != old); in swap_cgroup_record()
142 sc->id = id; in swap_cgroup_record()
151 spin_unlock_irqrestore(&ctrl->lock, flags); in swap_cgroup_record()
157 * lookup_swap_cgroup_id - lookup mem_cgroup id tied to swap entry
164 return lookup_swap_cgroup(ent, NULL)->id; in lookup_swap_cgroup_id()
184 ctrl->length = length; in swap_cgroup_swapon()
185 ctrl->map = array; in swap_cgroup_swapon()
186 spin_lock_init(&ctrl->lock); in swap_cgroup_swapon()
189 ctrl->map = NULL; in swap_cgroup_swapon()
190 ctrl->length = 0; in swap_cgroup_swapon()
201 return -ENOMEM; in swap_cgroup_swapon()
206 struct page **map; in swap_cgroup_swapoff() local
215 map = ctrl->map; in swap_cgroup_swapoff()
216 length = ctrl->length; in swap_cgroup_swapoff()
217 ctrl->map = NULL; in swap_cgroup_swapoff()
218 ctrl->length = 0; in swap_cgroup_swapoff()
221 if (map) { in swap_cgroup_swapoff()
223 struct page *page = map[i]; in swap_cgroup_swapoff()
229 vfree(map); in swap_cgroup_swapoff()