mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
mm: memcontrol: constify the zswap and socket pressure helpers
mem_cgroup_zswap_writeback_enabled() only reads the zswap_writeback flags, and mem_cgroup_get_socket_pressure() only reads the socket pressure timestamp. Constify them. Link: https://lore.kernel.org/20260915-folio_memcg-const-v3-11-c239a6010b58@columbia.edu Signed-off-by: Tal Zussman <tz2294@columbia.edu> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Acked-by: Muchun Song <muchun.song@linux.dev> Acked-by: Shakeel Butt <shakeel.butt@linux.dev> Acked-by: Lorenzo Stoakes (ARM) <ljs@kernel.org> Cc: Axel Rasmussen <axelrasmussen@google.com> Cc: Baolin Wang <baolin.wang@linux.alibaba.com> Cc: Baoquan He <baoquan.he@linux.dev> Cc: Barry Song <baohua@kernel.org> Cc: Chris Li <chrisl@kernel.org> Cc: David Hildenbrand <david@kernel.org> Cc: Johannes Weiner <hannes@cmpxchg.org> Cc: Kairui Song <kasong@tencent.com> Cc: Kemeng Shi <shikemeng@huaweicloud.com> Cc: Liam R. Howlett <liam@infradead.org> Cc: Matthew Wilcox (Oracle) <willy@infradead.org> Cc: Michal Hocko <mhocko@kernel.org> Cc: Mike Rapoport <rppt@kernel.org> Cc: Nhat Pham <nphamcs@gmail.com> Cc: Roman Gushchin <roman.gushchin@linux.dev> Cc: Suren Baghdasaryan <surenb@google.com> Cc: Vlastimil Babka <vbabka@kernel.org> Cc: Wei Xu <weixugc@google.com> Cc: Yuanchu Xie <yuanchu@google.com>
This commit is contained in:
parent
bc936f771a
commit
de6be06f4a
|
|
@ -1684,7 +1684,7 @@ static inline void mem_cgroup_set_socket_pressure(struct mem_cgroup *memcg)
|
|||
write_sequnlock_irqrestore(&memcg->socket_pressure_seqlock, flags);
|
||||
}
|
||||
|
||||
static inline u64 mem_cgroup_get_socket_pressure(struct mem_cgroup *memcg)
|
||||
static inline u64 mem_cgroup_get_socket_pressure(const struct mem_cgroup *memcg)
|
||||
{
|
||||
unsigned int seq;
|
||||
u64 val;
|
||||
|
|
@ -1702,7 +1702,7 @@ static inline void mem_cgroup_set_socket_pressure(struct mem_cgroup *memcg)
|
|||
WRITE_ONCE(memcg->socket_pressure, jiffies + HZ);
|
||||
}
|
||||
|
||||
static inline u64 mem_cgroup_get_socket_pressure(struct mem_cgroup *memcg)
|
||||
static inline u64 mem_cgroup_get_socket_pressure(const struct mem_cgroup *memcg)
|
||||
{
|
||||
return READ_ONCE(memcg->socket_pressure);
|
||||
}
|
||||
|
|
@ -1937,7 +1937,7 @@ static inline void mem_cgroup_calculate_protection_path(struct mem_cgroup *root,
|
|||
bool obj_cgroup_may_zswap(struct obj_cgroup *objcg);
|
||||
void obj_cgroup_charge_zswap(struct obj_cgroup *objcg, size_t size);
|
||||
void obj_cgroup_uncharge_zswap(struct obj_cgroup *objcg, size_t size);
|
||||
bool mem_cgroup_zswap_writeback_enabled(struct mem_cgroup *memcg);
|
||||
bool mem_cgroup_zswap_writeback_enabled(const struct mem_cgroup *memcg);
|
||||
#else
|
||||
static inline bool obj_cgroup_may_zswap(struct obj_cgroup *objcg)
|
||||
{
|
||||
|
|
@ -1951,7 +1951,7 @@ static inline void obj_cgroup_uncharge_zswap(struct obj_cgroup *objcg,
|
|||
size_t size)
|
||||
{
|
||||
}
|
||||
static inline bool mem_cgroup_zswap_writeback_enabled(struct mem_cgroup *memcg)
|
||||
static inline bool mem_cgroup_zswap_writeback_enabled(const struct mem_cgroup *memcg)
|
||||
{
|
||||
/* if zswap is disabled, do not block pages going to the swapping device */
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -6318,7 +6318,7 @@ void obj_cgroup_uncharge_zswap(struct obj_cgroup *objcg, size_t size)
|
|||
rcu_read_unlock();
|
||||
}
|
||||
|
||||
bool mem_cgroup_zswap_writeback_enabled(struct mem_cgroup *memcg)
|
||||
bool mem_cgroup_zswap_writeback_enabled(const struct mem_cgroup *memcg)
|
||||
{
|
||||
/* if zswap is disabled, do not block pages going to the swapping device */
|
||||
if (!zswap_is_enabled())
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user