2022-10-19 15:31:33 -07:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
2019-03-07 17:46:10 -07:00
|
|
|
|
|
|
|
#include "bcachefs.h"
|
2020-06-15 16:53:46 -07:00
|
|
|
#include "btree_cache.h"
|
2019-03-07 17:46:10 -07:00
|
|
|
#include "btree_iter.h"
|
|
|
|
#include "btree_key_cache.h"
|
|
|
|
#include "btree_locking.h"
|
|
|
|
#include "btree_update.h"
|
2022-07-17 20:06:38 -07:00
|
|
|
#include "errcode.h"
|
2019-03-07 17:46:10 -07:00
|
|
|
#include "error.h"
|
|
|
|
#include "journal.h"
|
|
|
|
#include "journal_reclaim.h"
|
|
|
|
#include "trace.h"
|
|
|
|
|
2020-11-12 15:19:47 -07:00
|
|
|
#include <linux/sched/mm.h>
|
|
|
|
|
2022-09-03 19:07:31 -07:00
|
|
|
static inline bool btree_uses_pcpu_readers(enum btree_id id)
|
|
|
|
{
|
|
|
|
return id == BTREE_ID_subvolumes;
|
|
|
|
}
|
|
|
|
|
2020-11-18 12:09:33 -07:00
|
|
|
static struct kmem_cache *bch2_key_cache;
|
|
|
|
|
2019-03-07 17:46:10 -07:00
|
|
|
static int bch2_btree_key_cache_cmp_fn(struct rhashtable_compare_arg *arg,
|
|
|
|
const void *obj)
|
|
|
|
{
|
|
|
|
const struct bkey_cached *ck = obj;
|
|
|
|
const struct bkey_cached_key *key = arg->key;
|
|
|
|
|
2022-11-24 01:12:22 -07:00
|
|
|
return ck->key.btree_id != key->btree_id ||
|
|
|
|
!bpos_eq(ck->key.pos, key->pos);
|
2019-03-07 17:46:10 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static const struct rhashtable_params bch2_btree_key_cache_params = {
|
2024-06-06 15:56:59 -07:00
|
|
|
.head_offset = offsetof(struct bkey_cached, hash),
|
|
|
|
.key_offset = offsetof(struct bkey_cached, key),
|
|
|
|
.key_len = sizeof(struct bkey_cached_key),
|
|
|
|
.obj_cmpfn = bch2_btree_key_cache_cmp_fn,
|
|
|
|
.automatic_shrinking = true,
|
2019-03-07 17:46:10 -07:00
|
|
|
};
|
|
|
|
|
2024-06-08 12:24:14 -07:00
|
|
|
static inline void btree_path_cached_set(struct btree_trans *trans, struct btree_path *path,
|
|
|
|
struct bkey_cached *ck,
|
|
|
|
enum btree_node_locked_type lock_held)
|
|
|
|
{
|
|
|
|
path->l[0].lock_seq = six_lock_seq(&ck->c.lock);
|
|
|
|
path->l[0].b = (void *) ck;
|
|
|
|
mark_btree_node_locked(trans, path, 0, lock_held);
|
|
|
|
}
|
|
|
|
|
2019-03-07 17:46:10 -07:00
|
|
|
__flatten
|
2019-09-22 16:10:21 -07:00
|
|
|
inline struct bkey_cached *
|
|
|
|
bch2_btree_key_cache_find(struct bch_fs *c, enum btree_id btree_id, struct bpos pos)
|
2019-03-07 17:46:10 -07:00
|
|
|
{
|
|
|
|
struct bkey_cached_key key = {
|
|
|
|
.btree_id = btree_id,
|
|
|
|
.pos = pos,
|
|
|
|
};
|
|
|
|
|
|
|
|
return rhashtable_lookup_fast(&c->btree_key_cache.table, &key,
|
|
|
|
bch2_btree_key_cache_params);
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool bkey_cached_lock_for_evict(struct bkey_cached *ck)
|
|
|
|
{
|
|
|
|
if (!six_trylock_intent(&ck->c.lock))
|
|
|
|
return false;
|
|
|
|
|
2023-01-07 22:05:30 -07:00
|
|
|
if (test_bit(BKEY_CACHED_DIRTY, &ck->flags)) {
|
2019-03-07 17:46:10 -07:00
|
|
|
six_unlock_intent(&ck->c.lock);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2023-01-07 22:05:30 -07:00
|
|
|
if (!six_trylock_write(&ck->c.lock)) {
|
2019-03-07 17:46:10 -07:00
|
|
|
six_unlock_intent(&ck->c.lock);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2024-06-08 19:32:40 -07:00
|
|
|
static bool bkey_cached_evict(struct btree_key_cache *c,
|
2019-03-07 17:46:10 -07:00
|
|
|
struct bkey_cached *ck)
|
|
|
|
{
|
2024-06-08 19:32:40 -07:00
|
|
|
bool ret = !rhashtable_remove_fast(&c->table, &ck->hash,
|
|
|
|
bch2_btree_key_cache_params);
|
|
|
|
if (ret) {
|
|
|
|
memset(&ck->key, ~0, sizeof(ck->key));
|
|
|
|
atomic_long_dec(&c->nr_keys);
|
2023-11-06 07:53:14 -07:00
|
|
|
}
|
2019-03-07 17:46:10 -07:00
|
|
|
|
2024-06-08 19:32:40 -07:00
|
|
|
return ret;
|
2019-03-07 17:46:10 -07:00
|
|
|
}
|
|
|
|
|
2024-06-13 12:35:47 -07:00
|
|
|
static void __bkey_cached_free(struct rcu_pending *pending, struct rcu_head *rcu)
|
2022-10-16 23:08:07 -07:00
|
|
|
{
|
2024-06-13 12:35:47 -07:00
|
|
|
struct bch_fs *c = container_of(pending->srcu, struct bch_fs, btree_trans_barrier);
|
2024-06-08 19:32:40 -07:00
|
|
|
struct bkey_cached *ck = container_of(rcu, struct bkey_cached, rcu);
|
2023-11-06 07:53:14 -07:00
|
|
|
|
2024-06-13 12:35:47 -07:00
|
|
|
this_cpu_dec(*c->btree_key_cache.nr_pending);
|
2024-06-08 19:32:40 -07:00
|
|
|
kmem_cache_free(bch2_key_cache, ck);
|
2022-10-16 23:08:07 -07:00
|
|
|
}
|
2022-06-16 22:07:54 -07:00
|
|
|
|
2024-06-08 19:32:40 -07:00
|
|
|
static void bkey_cached_free(struct btree_key_cache *bc,
|
|
|
|
struct bkey_cached *ck)
|
2022-08-21 11:29:43 -07:00
|
|
|
{
|
|
|
|
kfree(ck->k);
|
|
|
|
ck->k = NULL;
|
|
|
|
ck->u64s = 0;
|
|
|
|
|
2022-06-16 22:07:54 -07:00
|
|
|
six_unlock_write(&ck->c.lock);
|
|
|
|
six_unlock_intent(&ck->c.lock);
|
2024-06-08 19:32:40 -07:00
|
|
|
|
2024-06-13 12:35:47 -07:00
|
|
|
bool pcpu_readers = ck->c.lock.readers != NULL;
|
|
|
|
rcu_pending_enqueue(&bc->pending[pcpu_readers], &ck->rcu);
|
|
|
|
this_cpu_inc(*bc->nr_pending);
|
2022-06-16 22:07:54 -07:00
|
|
|
}
|
|
|
|
|
2024-06-08 14:49:11 -07:00
|
|
|
static struct bkey_cached *__bkey_cached_alloc(unsigned key_u64s, gfp_t gfp)
|
|
|
|
{
|
2024-09-03 14:42:53 -07:00
|
|
|
gfp |= __GFP_ACCOUNT|__GFP_RECLAIMABLE;
|
|
|
|
|
2024-06-08 14:49:11 -07:00
|
|
|
struct bkey_cached *ck = kmem_cache_zalloc(bch2_key_cache, gfp);
|
|
|
|
if (unlikely(!ck))
|
|
|
|
return NULL;
|
|
|
|
ck->k = kmalloc(key_u64s * sizeof(u64), gfp);
|
|
|
|
if (unlikely(!ck->k)) {
|
|
|
|
kmem_cache_free(bch2_key_cache, ck);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
ck->u64s = key_u64s;
|
|
|
|
return ck;
|
|
|
|
}
|
|
|
|
|
2019-03-07 17:46:10 -07:00
|
|
|
static struct bkey_cached *
|
2024-06-08 14:49:11 -07:00
|
|
|
bkey_cached_alloc(struct btree_trans *trans, struct btree_path *path, unsigned key_u64s)
|
2019-03-07 17:46:10 -07:00
|
|
|
{
|
2024-06-13 12:35:47 -07:00
|
|
|
struct bch_fs *c = trans->c;
|
|
|
|
struct btree_key_cache *bc = &c->btree_key_cache;
|
2022-09-03 19:07:31 -07:00
|
|
|
bool pcpu_readers = btree_uses_pcpu_readers(path->btree_id);
|
2023-01-07 03:46:52 -07:00
|
|
|
int ret;
|
2022-06-16 22:07:54 -07:00
|
|
|
|
2024-06-13 12:35:47 -07:00
|
|
|
struct bkey_cached *ck = container_of_or_null(
|
|
|
|
rcu_pending_dequeue(&bc->pending[pcpu_readers]),
|
|
|
|
struct bkey_cached, rcu);
|
|
|
|
if (ck)
|
|
|
|
goto lock;
|
|
|
|
|
|
|
|
ck = allocate_dropping_locks(trans, ret,
|
2024-06-08 14:49:11 -07:00
|
|
|
__bkey_cached_alloc(key_u64s, _gfp));
|
2023-01-07 03:46:52 -07:00
|
|
|
if (ret) {
|
2024-06-08 14:49:11 -07:00
|
|
|
if (ck)
|
|
|
|
kfree(ck->k);
|
2023-01-07 03:46:52 -07:00
|
|
|
kmem_cache_free(bch2_key_cache, ck);
|
|
|
|
return ERR_PTR(ret);
|
2020-11-19 13:38:27 -07:00
|
|
|
}
|
2019-03-07 17:46:10 -07:00
|
|
|
|
2024-06-13 12:35:47 -07:00
|
|
|
if (ck) {
|
|
|
|
bch2_btree_lock_init(&ck->c, pcpu_readers ? SIX_LOCK_INIT_PCPU : 0);
|
|
|
|
ck->c.cached = true;
|
|
|
|
goto lock;
|
|
|
|
}
|
2023-01-07 03:46:52 -07:00
|
|
|
|
2024-06-13 12:35:47 -07:00
|
|
|
ck = container_of_or_null(rcu_pending_dequeue_from_all(&bc->pending[pcpu_readers]),
|
|
|
|
struct bkey_cached, rcu);
|
|
|
|
if (ck)
|
|
|
|
goto lock;
|
|
|
|
lock:
|
|
|
|
six_lock_intent(&ck->c.lock, NULL, NULL);
|
|
|
|
six_lock_write(&ck->c.lock, NULL, NULL);
|
2023-01-07 03:46:52 -07:00
|
|
|
return ck;
|
2021-03-24 20:37:33 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static struct bkey_cached *
|
|
|
|
bkey_cached_reuse(struct btree_key_cache *c)
|
|
|
|
{
|
|
|
|
struct bucket_table *tbl;
|
|
|
|
struct rhash_head *pos;
|
|
|
|
struct bkey_cached *ck;
|
|
|
|
unsigned i;
|
|
|
|
|
|
|
|
rcu_read_lock();
|
|
|
|
tbl = rht_dereference_rcu(c->table.tbl, &c->table);
|
|
|
|
for (i = 0; i < tbl->size; i++)
|
|
|
|
rht_for_each_entry_rcu(ck, pos, tbl, i, hash) {
|
|
|
|
if (!test_bit(BKEY_CACHED_DIRTY, &ck->flags) &&
|
|
|
|
bkey_cached_lock_for_evict(ck)) {
|
2024-06-08 19:32:40 -07:00
|
|
|
if (bkey_cached_evict(c, ck))
|
|
|
|
goto out;
|
|
|
|
six_unlock_write(&ck->c.lock);
|
|
|
|
six_unlock_intent(&ck->c.lock);
|
2021-03-24 20:37:33 -07:00
|
|
|
}
|
|
|
|
}
|
2022-10-14 21:47:21 -07:00
|
|
|
ck = NULL;
|
|
|
|
out:
|
2021-03-24 20:37:33 -07:00
|
|
|
rcu_read_unlock();
|
2022-10-14 21:47:21 -07:00
|
|
|
return ck;
|
2019-03-07 17:46:10 -07:00
|
|
|
}
|
|
|
|
|
2024-06-08 14:49:11 -07:00
|
|
|
static int btree_key_cache_create(struct btree_trans *trans, struct btree_path *path,
|
|
|
|
struct bkey_s_c k)
|
2019-03-07 17:46:10 -07:00
|
|
|
{
|
2022-08-21 11:29:43 -07:00
|
|
|
struct bch_fs *c = trans->c;
|
2021-12-30 18:14:52 -07:00
|
|
|
struct btree_key_cache *bc = &c->btree_key_cache;
|
2019-03-07 17:46:10 -07:00
|
|
|
|
2024-06-08 14:49:11 -07:00
|
|
|
/*
|
|
|
|
* bch2_varint_decode can read past the end of the buffer by at
|
|
|
|
* most 7 bytes (it won't be used):
|
|
|
|
*/
|
|
|
|
unsigned key_u64s = k.k->u64s + 1;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Allocate some extra space so that the transaction commit path is less
|
|
|
|
* likely to have to reallocate, since that requires a transaction
|
|
|
|
* restart:
|
|
|
|
*/
|
|
|
|
key_u64s = min(256U, (key_u64s * 3) / 2);
|
|
|
|
key_u64s = roundup_pow_of_two(key_u64s);
|
|
|
|
|
|
|
|
struct bkey_cached *ck = bkey_cached_alloc(trans, path, key_u64s);
|
|
|
|
int ret = PTR_ERR_OR_ZERO(ck);
|
|
|
|
if (ret)
|
|
|
|
return ret;
|
2021-03-24 20:37:33 -07:00
|
|
|
|
|
|
|
if (unlikely(!ck)) {
|
2021-12-30 18:14:52 -07:00
|
|
|
ck = bkey_cached_reuse(bc);
|
|
|
|
if (unlikely(!ck)) {
|
|
|
|
bch_err(c, "error allocating memory for key cache item, btree %s",
|
2023-10-19 19:49:08 -07:00
|
|
|
bch2_btree_id_str(path->btree_id));
|
2024-06-08 14:49:11 -07:00
|
|
|
return -BCH_ERR_ENOMEM_btree_key_cache_create;
|
2021-12-30 18:14:52 -07:00
|
|
|
}
|
2021-03-24 20:37:33 -07:00
|
|
|
}
|
2019-03-07 17:46:10 -07:00
|
|
|
|
|
|
|
ck->c.level = 0;
|
2022-09-03 18:14:53 -07:00
|
|
|
ck->c.btree_id = path->btree_id;
|
|
|
|
ck->key.btree_id = path->btree_id;
|
|
|
|
ck->key.pos = path->pos;
|
2020-11-19 13:38:27 -07:00
|
|
|
ck->flags = 1U << BKEY_CACHED_ACCESSED;
|
2019-03-07 17:46:10 -07:00
|
|
|
|
2024-06-08 14:49:11 -07:00
|
|
|
if (unlikely(key_u64s > ck->u64s)) {
|
|
|
|
mark_btree_node_locked_noreset(path, 0, BTREE_NODE_UNLOCKED);
|
|
|
|
|
|
|
|
struct bkey_i *new_k = allocate_dropping_locks(trans, ret,
|
|
|
|
kmalloc(key_u64s * sizeof(u64), _gfp));
|
|
|
|
if (unlikely(!new_k)) {
|
|
|
|
bch_err(trans->c, "error allocating memory for key cache key, btree %s u64s %u",
|
|
|
|
bch2_btree_id_str(ck->key.btree_id), key_u64s);
|
|
|
|
ret = -BCH_ERR_ENOMEM_btree_key_cache_fill;
|
|
|
|
} else if (ret) {
|
|
|
|
kfree(new_k);
|
|
|
|
goto err;
|
2021-03-24 20:37:33 -07:00
|
|
|
}
|
|
|
|
|
2024-06-08 14:49:11 -07:00
|
|
|
kfree(ck->k);
|
|
|
|
ck->k = new_k;
|
|
|
|
ck->u64s = key_u64s;
|
2019-03-07 17:46:10 -07:00
|
|
|
}
|
|
|
|
|
2024-06-08 14:49:11 -07:00
|
|
|
bkey_reassemble(ck->k, k);
|
2020-11-09 11:01:52 -07:00
|
|
|
|
2024-06-08 14:49:11 -07:00
|
|
|
ret = rhashtable_lookup_insert_fast(&bc->table, &ck->hash, bch2_btree_key_cache_params);
|
|
|
|
if (unlikely(ret)) /* raced with another fill? */
|
|
|
|
goto err;
|
|
|
|
|
|
|
|
atomic_long_inc(&bc->nr_keys);
|
2019-03-07 17:46:10 -07:00
|
|
|
six_unlock_write(&ck->c.lock);
|
|
|
|
|
2024-06-08 14:49:11 -07:00
|
|
|
enum six_lock_type lock_want = __btree_lock_want(path, 0);
|
|
|
|
if (lock_want == SIX_LOCK_read)
|
|
|
|
six_lock_downgrade(&ck->c.lock);
|
|
|
|
btree_path_cached_set(trans, path, ck, (enum btree_node_locked_type) lock_want);
|
|
|
|
path->uptodate = BTREE_ITER_UPTODATE;
|
|
|
|
return 0;
|
|
|
|
err:
|
2024-06-08 19:32:40 -07:00
|
|
|
bkey_cached_free(bc, ck);
|
2024-06-08 14:49:11 -07:00
|
|
|
mark_btree_node_locked_noreset(path, 0, BTREE_NODE_UNLOCKED);
|
|
|
|
|
|
|
|
return ret;
|
2019-03-07 17:46:10 -07:00
|
|
|
}
|
|
|
|
|
2024-06-08 14:49:11 -07:00
|
|
|
static noinline int btree_key_cache_fill(struct btree_trans *trans,
|
|
|
|
struct btree_path *ck_path,
|
|
|
|
unsigned flags)
|
2019-03-07 17:46:10 -07:00
|
|
|
{
|
2024-06-08 14:49:11 -07:00
|
|
|
if (flags & BTREE_ITER_cached_nofill) {
|
|
|
|
ck_path->uptodate = BTREE_ITER_UPTODATE;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
struct bch_fs *c = trans->c;
|
2022-11-22 18:15:33 -07:00
|
|
|
struct btree_iter iter;
|
2019-03-07 17:46:10 -07:00
|
|
|
struct bkey_s_c k;
|
|
|
|
int ret;
|
|
|
|
|
2024-06-08 14:49:11 -07:00
|
|
|
bch2_trans_iter_init(trans, &iter, ck_path->btree_id, ck_path->pos,
|
2024-04-07 15:05:34 -07:00
|
|
|
BTREE_ITER_key_cache_fill|
|
|
|
|
BTREE_ITER_cached_nofill);
|
|
|
|
iter.flags &= ~BTREE_ITER_with_journal;
|
2024-03-10 17:53:17 -07:00
|
|
|
k = bch2_btree_iter_peek_slot(&iter);
|
2022-11-22 18:15:33 -07:00
|
|
|
ret = bkey_err(k);
|
2021-03-19 19:54:18 -07:00
|
|
|
if (ret)
|
|
|
|
goto err;
|
2019-03-07 17:46:10 -07:00
|
|
|
|
2024-06-08 14:49:11 -07:00
|
|
|
/* Recheck after btree lookup, before allocating: */
|
|
|
|
ret = bch2_btree_key_cache_find(c, ck_path->btree_id, ck_path->pos) ? -EEXIST : 0;
|
|
|
|
if (unlikely(ret))
|
|
|
|
goto out;
|
2019-03-07 17:46:10 -07:00
|
|
|
|
2024-06-08 14:49:11 -07:00
|
|
|
ret = btree_key_cache_create(trans, ck_path, k);
|
|
|
|
if (ret)
|
2022-08-22 20:39:23 -07:00
|
|
|
goto err;
|
2024-06-08 14:49:11 -07:00
|
|
|
out:
|
2019-03-07 17:46:10 -07:00
|
|
|
/* We're not likely to need this iterator again: */
|
2024-04-24 23:20:20 -07:00
|
|
|
bch2_set_btree_iter_dontneed(&iter);
|
2021-03-19 19:54:18 -07:00
|
|
|
err:
|
2022-11-22 18:15:33 -07:00
|
|
|
bch2_trans_iter_exit(trans, &iter);
|
2021-03-19 19:54:18 -07:00
|
|
|
return ret;
|
2019-03-07 17:46:10 -07:00
|
|
|
}
|
|
|
|
|
2024-06-08 14:49:11 -07:00
|
|
|
static inline int btree_path_traverse_cached_fast(struct btree_trans *trans,
|
|
|
|
struct btree_path *path)
|
2019-03-07 17:46:10 -07:00
|
|
|
{
|
|
|
|
struct bch_fs *c = trans->c;
|
|
|
|
struct bkey_cached *ck;
|
|
|
|
retry:
|
2021-08-30 12:18:31 -07:00
|
|
|
ck = bch2_btree_key_cache_find(c, path->btree_id, path->pos);
|
2024-06-08 14:49:11 -07:00
|
|
|
if (!ck)
|
|
|
|
return -ENOENT;
|
2019-03-07 17:46:10 -07:00
|
|
|
|
2024-06-08 14:49:11 -07:00
|
|
|
enum six_lock_type lock_want = __btree_lock_want(path, 0);
|
2023-01-25 08:15:39 -07:00
|
|
|
|
2024-06-08 14:49:11 -07:00
|
|
|
int ret = btree_node_lock(trans, path, (void *) ck, 0, lock_want, _THIS_IP_);
|
|
|
|
if (ret)
|
|
|
|
return ret;
|
2023-01-25 08:15:39 -07:00
|
|
|
|
2024-06-08 14:49:11 -07:00
|
|
|
if (ck->key.btree_id != path->btree_id ||
|
|
|
|
!bpos_eq(ck->key.pos, path->pos)) {
|
|
|
|
six_unlock_type(&ck->c.lock, lock_want);
|
|
|
|
goto retry;
|
2019-03-07 17:46:10 -07:00
|
|
|
}
|
|
|
|
|
2020-11-19 13:38:27 -07:00
|
|
|
if (!test_bit(BKEY_CACHED_ACCESSED, &ck->flags))
|
|
|
|
set_bit(BKEY_CACHED_ACCESSED, &ck->flags);
|
|
|
|
|
2024-06-08 14:49:11 -07:00
|
|
|
btree_path_cached_set(trans, path, ck, (enum btree_node_locked_type) lock_want);
|
|
|
|
path->uptodate = BTREE_ITER_UPTODATE;
|
|
|
|
return 0;
|
2019-03-07 17:46:10 -07:00
|
|
|
}
|
|
|
|
|
2022-09-26 19:34:49 -07:00
|
|
|
int bch2_btree_path_traverse_cached(struct btree_trans *trans, struct btree_path *path,
|
|
|
|
unsigned flags)
|
|
|
|
{
|
|
|
|
EBUG_ON(path->level);
|
|
|
|
|
|
|
|
path->l[1].b = NULL;
|
|
|
|
|
2024-06-08 14:49:11 -07:00
|
|
|
int ret;
|
|
|
|
do {
|
|
|
|
ret = btree_path_traverse_cached_fast(trans, path);
|
|
|
|
if (unlikely(ret == -ENOENT))
|
|
|
|
ret = btree_key_cache_fill(trans, path, flags);
|
|
|
|
} while (ret == -EEXIST);
|
|
|
|
|
|
|
|
if (unlikely(ret)) {
|
|
|
|
path->uptodate = BTREE_ITER_NEED_TRAVERSE;
|
|
|
|
if (!bch2_err_matches(ret, BCH_ERR_transaction_restart)) {
|
|
|
|
btree_node_unlock(trans, path, 0);
|
|
|
|
path->l[0].b = ERR_PTR(ret);
|
|
|
|
}
|
2022-09-26 19:34:49 -07:00
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2019-03-07 17:46:10 -07:00
|
|
|
static int btree_key_cache_flush_pos(struct btree_trans *trans,
|
|
|
|
struct bkey_cached_key key,
|
|
|
|
u64 journal_seq,
|
2021-04-03 13:24:13 -07:00
|
|
|
unsigned commit_flags,
|
2019-03-07 17:46:10 -07:00
|
|
|
bool evict)
|
|
|
|
{
|
|
|
|
struct bch_fs *c = trans->c;
|
|
|
|
struct journal *j = &c->journal;
|
2021-08-30 12:18:31 -07:00
|
|
|
struct btree_iter c_iter, b_iter;
|
2020-12-03 11:09:08 -07:00
|
|
|
struct bkey_cached *ck = NULL;
|
2019-03-07 17:46:10 -07:00
|
|
|
int ret;
|
|
|
|
|
2021-08-30 12:18:31 -07:00
|
|
|
bch2_trans_iter_init(trans, &b_iter, key.btree_id, key.pos,
|
2024-04-07 15:05:34 -07:00
|
|
|
BTREE_ITER_slots|
|
|
|
|
BTREE_ITER_intent|
|
|
|
|
BTREE_ITER_all_snapshots);
|
2021-08-30 12:18:31 -07:00
|
|
|
bch2_trans_iter_init(trans, &c_iter, key.btree_id, key.pos,
|
2024-04-07 15:05:34 -07:00
|
|
|
BTREE_ITER_cached|
|
|
|
|
BTREE_ITER_intent);
|
|
|
|
b_iter.flags &= ~BTREE_ITER_with_key_cache;
|
2022-02-06 21:15:12 -07:00
|
|
|
|
2021-08-30 12:18:31 -07:00
|
|
|
ret = bch2_btree_iter_traverse(&c_iter);
|
2019-03-07 17:46:10 -07:00
|
|
|
if (ret)
|
2021-07-23 15:26:38 -07:00
|
|
|
goto out;
|
2019-03-07 17:46:10 -07:00
|
|
|
|
2023-12-03 22:39:38 -07:00
|
|
|
ck = (void *) btree_iter_path(trans, &c_iter)->l[0].b;
|
2022-01-11 22:49:23 -07:00
|
|
|
if (!ck)
|
2019-03-07 17:46:10 -07:00
|
|
|
goto out;
|
|
|
|
|
|
|
|
if (!test_bit(BKEY_CACHED_DIRTY, &ck->flags)) {
|
2022-01-11 22:49:23 -07:00
|
|
|
if (evict)
|
|
|
|
goto evict;
|
|
|
|
goto out;
|
2019-03-07 17:46:10 -07:00
|
|
|
}
|
|
|
|
|
2022-01-11 22:49:23 -07:00
|
|
|
if (journal_seq && ck->journal.seq != journal_seq)
|
|
|
|
goto out;
|
|
|
|
|
2023-11-13 19:12:35 -07:00
|
|
|
trans->journal_res.seq = ck->journal.seq;
|
|
|
|
|
2021-04-20 14:09:25 -07:00
|
|
|
/*
|
2023-11-13 19:12:35 -07:00
|
|
|
* If we're at the end of the journal, we really want to free up space
|
|
|
|
* in the journal right away - we don't want to pin that old journal
|
|
|
|
* sequence number with a new btree node write, we want to re-journal
|
|
|
|
* the update
|
2022-10-19 15:31:33 -07:00
|
|
|
*/
|
2023-11-13 19:12:35 -07:00
|
|
|
if (ck->journal.seq == journal_last_seq(j))
|
|
|
|
commit_flags |= BCH_WATERMARK_reclaim;
|
2023-12-19 18:54:11 -07:00
|
|
|
|
|
|
|
if (ck->journal.seq != journal_last_seq(j) ||
|
2024-04-30 03:20:37 -07:00
|
|
|
!test_bit(JOURNAL_space_low, &c->journal.flags))
|
2023-11-13 19:12:35 -07:00
|
|
|
commit_flags |= BCH_TRANS_COMMIT_no_journal_res;
|
|
|
|
|
2021-08-30 12:18:31 -07:00
|
|
|
ret = bch2_btree_iter_traverse(&b_iter) ?:
|
|
|
|
bch2_trans_update(trans, &b_iter, ck->k,
|
2024-04-07 15:05:34 -07:00
|
|
|
BTREE_UPDATE_key_cache_reclaim|
|
|
|
|
BTREE_UPDATE_internal_snapshot_node|
|
|
|
|
BTREE_TRIGGER_norun) ?:
|
2019-03-07 17:46:10 -07:00
|
|
|
bch2_trans_commit(trans, NULL, NULL,
|
2023-11-11 14:31:50 -07:00
|
|
|
BCH_TRANS_COMMIT_no_check_rw|
|
|
|
|
BCH_TRANS_COMMIT_no_enospc|
|
2021-04-03 13:24:13 -07:00
|
|
|
commit_flags);
|
2022-07-17 20:06:38 -07:00
|
|
|
|
|
|
|
bch2_fs_fatal_err_on(ret &&
|
|
|
|
!bch2_err_matches(ret, BCH_ERR_transaction_restart) &&
|
|
|
|
!bch2_err_matches(ret, BCH_ERR_journal_reclaim_would_deadlock) &&
|
|
|
|
!bch2_journal_error(j), c,
|
2024-03-17 18:51:19 -07:00
|
|
|
"flushing key cache: %s", bch2_err_str(ret));
|
2022-07-17 20:06:38 -07:00
|
|
|
if (ret)
|
2019-03-07 17:46:10 -07:00
|
|
|
goto out;
|
|
|
|
|
|
|
|
bch2_journal_pin_drop(j, &ck->journal);
|
|
|
|
|
2023-12-03 22:39:38 -07:00
|
|
|
struct btree_path *path = btree_iter_path(trans, &c_iter);
|
|
|
|
BUG_ON(!btree_node_locked(path, 0));
|
2021-03-24 20:37:33 -07:00
|
|
|
|
2019-03-07 17:46:10 -07:00
|
|
|
if (!evict) {
|
2020-11-09 11:01:52 -07:00
|
|
|
if (test_bit(BKEY_CACHED_DIRTY, &ck->flags)) {
|
|
|
|
clear_bit(BKEY_CACHED_DIRTY, &ck->flags);
|
2021-03-24 20:37:33 -07:00
|
|
|
atomic_long_dec(&c->btree_key_cache.nr_dirty);
|
2020-11-09 11:01:52 -07:00
|
|
|
}
|
2019-03-07 17:46:10 -07:00
|
|
|
} else {
|
2022-09-02 19:59:39 -07:00
|
|
|
struct btree_path *path2;
|
2023-12-10 21:37:45 -07:00
|
|
|
unsigned i;
|
2019-03-07 17:46:10 -07:00
|
|
|
evict:
|
2023-12-10 21:37:45 -07:00
|
|
|
trans_for_each_path(trans, path2, i)
|
2023-12-03 22:39:38 -07:00
|
|
|
if (path2 != path)
|
2022-09-02 19:59:39 -07:00
|
|
|
__bch2_btree_path_unlock(trans, path2);
|
2019-03-07 17:46:10 -07:00
|
|
|
|
2023-12-03 22:39:38 -07:00
|
|
|
bch2_btree_node_lock_write_nofail(trans, path, &ck->c);
|
2019-03-07 17:46:10 -07:00
|
|
|
|
2020-11-09 11:01:52 -07:00
|
|
|
if (test_bit(BKEY_CACHED_DIRTY, &ck->flags)) {
|
|
|
|
clear_bit(BKEY_CACHED_DIRTY, &ck->flags);
|
2021-03-24 20:37:33 -07:00
|
|
|
atomic_long_dec(&c->btree_key_cache.nr_dirty);
|
2020-11-09 11:01:52 -07:00
|
|
|
}
|
|
|
|
|
2023-12-03 22:39:38 -07:00
|
|
|
mark_btree_node_locked_noreset(path, 0, BTREE_NODE_UNLOCKED);
|
2024-06-08 19:32:40 -07:00
|
|
|
if (bkey_cached_evict(&c->btree_key_cache, ck)) {
|
|
|
|
bkey_cached_free(&c->btree_key_cache, ck);
|
|
|
|
} else {
|
|
|
|
six_unlock_write(&ck->c.lock);
|
|
|
|
six_unlock_intent(&ck->c.lock);
|
|
|
|
}
|
2019-03-07 17:46:10 -07:00
|
|
|
}
|
|
|
|
out:
|
2021-08-30 12:18:31 -07:00
|
|
|
bch2_trans_iter_exit(trans, &b_iter);
|
|
|
|
bch2_trans_iter_exit(trans, &c_iter);
|
2019-03-07 17:46:10 -07:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2021-03-31 18:44:55 -07:00
|
|
|
int bch2_btree_key_cache_journal_flush(struct journal *j,
|
|
|
|
struct journal_entry_pin *pin, u64 seq)
|
2019-03-07 17:46:10 -07:00
|
|
|
{
|
|
|
|
struct bch_fs *c = container_of(j, struct bch_fs, journal);
|
|
|
|
struct bkey_cached *ck =
|
|
|
|
container_of(pin, struct bkey_cached, journal);
|
|
|
|
struct bkey_cached_key key;
|
2023-09-12 14:16:02 -07:00
|
|
|
struct btree_trans *trans = bch2_trans_get(c);
|
2022-08-21 11:29:43 -07:00
|
|
|
int srcu_idx = srcu_read_lock(&c->btree_trans_barrier);
|
2021-04-03 13:24:13 -07:00
|
|
|
int ret = 0;
|
2019-03-07 17:46:10 -07:00
|
|
|
|
2023-09-12 14:16:02 -07:00
|
|
|
btree_node_lock_nopath_nofail(trans, &ck->c, SIX_LOCK_read);
|
2019-03-07 17:46:10 -07:00
|
|
|
key = ck->key;
|
|
|
|
|
|
|
|
if (ck->journal.seq != seq ||
|
|
|
|
!test_bit(BKEY_CACHED_DIRTY, &ck->flags)) {
|
|
|
|
six_unlock_read(&ck->c.lock);
|
2020-11-12 15:19:47 -07:00
|
|
|
goto unlock;
|
2019-03-07 17:46:10 -07:00
|
|
|
}
|
2023-01-04 02:34:16 -07:00
|
|
|
|
|
|
|
if (ck->seq != seq) {
|
|
|
|
bch2_journal_pin_update(&c->journal, ck->seq, &ck->journal,
|
|
|
|
bch2_btree_key_cache_journal_flush);
|
|
|
|
six_unlock_read(&ck->c.lock);
|
|
|
|
goto unlock;
|
|
|
|
}
|
2019-03-07 17:46:10 -07:00
|
|
|
six_unlock_read(&ck->c.lock);
|
|
|
|
|
2023-11-26 23:46:18 -07:00
|
|
|
ret = lockrestart_do(trans,
|
2023-09-12 14:16:02 -07:00
|
|
|
btree_key_cache_flush_pos(trans, key, seq,
|
2023-11-11 14:31:50 -07:00
|
|
|
BCH_TRANS_COMMIT_journal_reclaim, false));
|
2020-11-12 15:19:47 -07:00
|
|
|
unlock:
|
|
|
|
srcu_read_unlock(&c->btree_trans_barrier, srcu_idx);
|
2021-04-03 13:24:13 -07:00
|
|
|
|
2023-09-12 14:16:02 -07:00
|
|
|
bch2_trans_put(trans);
|
2021-04-03 13:24:13 -07:00
|
|
|
return ret;
|
2019-03-07 17:46:10 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
bool bch2_btree_insert_key_cached(struct btree_trans *trans,
|
2023-02-09 11:22:12 -07:00
|
|
|
unsigned flags,
|
bcachefs: don't bump key cache journal seq on nojournal commits
fstest generic/388 occasionally reproduces corruptions where an
inode has extents beyond i_size. This is a deliberate crash and
recovery test, and the post crash+recovery characteristics are
usually the same: the inode exists on disk in an early (i.e. just
allocated) state based on the journal sequence number associated
with the inode. Subsequent inode updates exist in the journal at
higher sequence numbers, but the inode hadn't been written back
before the associated crash and the post-crash recovery processes a
set of journal sequence numbers that doesn't include updates to the
inode. In fact, the sequence with the most recent inode key update
always happens to be the sequence just before the front of the
journal processed by recovery.
This last bit is a significant hint that the problem relates to an
on-disk journal update of the front of the journal. The root cause
of this problem is basically that the inode is updated (multiple
times) in-core and in the key cache, each time bumping the key cache
sequence number used to control the cache flush. The cache flush
skips one or more times, bumping the associated key cache journal
pin to the key cache seq value. This has a side effect of holding
the inode in memory a bit longer than normal, which helps exacerbate
this problem, but is also unsafe in certain cases where the key
cache seq may have been updated by a transaction commit that didn't
journal the associated key.
For example, consider an inode that has been allocated, updated
several times in the key cache, journaled, but not yet written back.
At this stage, everything should be consistent if the fs happens to
crash because the latest update has been journal. Now consider a key
update via bch2_extent_update_i_size_sectors() that uses the
BTREE_UPDATE_NOJOURNAL flag. While this update may not change inode
state, it can have the side effect of bumping ck->seq in
bch2_btree_insert_key_cached(). In turn, if a subsequent key cache
flush skips due to seq not matching the former, the ck->journal pin
is updated to ck->seq even though the most recent key update was not
journaled. If this pin happens to reside at the front (tail) of the
journal, this means a subsequent journal write can update last_seq
to a value beyond that which includes the most recent update to the
inode. If this occurs and the fs happens to crash before the inode
happens to flush, recovery will see the latest last_seq, fail to
recover the inode and leave the inode in the inconsistent state
described above.
To avoid this problem, skip the key cache seq update on NOJOURNAL
commits, except on initial pin add. Pass the insert entry directly
to bch2_btree_insert_key_cached() to make the associated flag
available and be consistent with btree_insert_key_leaf().
Signed-off-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-03-02 07:03:37 -07:00
|
|
|
struct btree_insert_entry *insert_entry)
|
2019-03-07 17:46:10 -07:00
|
|
|
{
|
|
|
|
struct bch_fs *c = trans->c;
|
2023-12-10 14:10:24 -07:00
|
|
|
struct bkey_cached *ck = (void *) (trans->paths + insert_entry->path)->l[0].b;
|
bcachefs: don't bump key cache journal seq on nojournal commits
fstest generic/388 occasionally reproduces corruptions where an
inode has extents beyond i_size. This is a deliberate crash and
recovery test, and the post crash+recovery characteristics are
usually the same: the inode exists on disk in an early (i.e. just
allocated) state based on the journal sequence number associated
with the inode. Subsequent inode updates exist in the journal at
higher sequence numbers, but the inode hadn't been written back
before the associated crash and the post-crash recovery processes a
set of journal sequence numbers that doesn't include updates to the
inode. In fact, the sequence with the most recent inode key update
always happens to be the sequence just before the front of the
journal processed by recovery.
This last bit is a significant hint that the problem relates to an
on-disk journal update of the front of the journal. The root cause
of this problem is basically that the inode is updated (multiple
times) in-core and in the key cache, each time bumping the key cache
sequence number used to control the cache flush. The cache flush
skips one or more times, bumping the associated key cache journal
pin to the key cache seq value. This has a side effect of holding
the inode in memory a bit longer than normal, which helps exacerbate
this problem, but is also unsafe in certain cases where the key
cache seq may have been updated by a transaction commit that didn't
journal the associated key.
For example, consider an inode that has been allocated, updated
several times in the key cache, journaled, but not yet written back.
At this stage, everything should be consistent if the fs happens to
crash because the latest update has been journal. Now consider a key
update via bch2_extent_update_i_size_sectors() that uses the
BTREE_UPDATE_NOJOURNAL flag. While this update may not change inode
state, it can have the side effect of bumping ck->seq in
bch2_btree_insert_key_cached(). In turn, if a subsequent key cache
flush skips due to seq not matching the former, the ck->journal pin
is updated to ck->seq even though the most recent key update was not
journaled. If this pin happens to reside at the front (tail) of the
journal, this means a subsequent journal write can update last_seq
to a value beyond that which includes the most recent update to the
inode. If this occurs and the fs happens to crash before the inode
happens to flush, recovery will see the latest last_seq, fail to
recover the inode and leave the inode in the inconsistent state
described above.
To avoid this problem, skip the key cache seq update on NOJOURNAL
commits, except on initial pin add. Pass the insert entry directly
to bch2_btree_insert_key_cached() to make the associated flag
available and be consistent with btree_insert_key_leaf().
Signed-off-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-03-02 07:03:37 -07:00
|
|
|
struct bkey_i *insert = insert_entry->k;
|
2020-11-19 17:54:40 -07:00
|
|
|
bool kick_reclaim = false;
|
2019-03-07 17:46:10 -07:00
|
|
|
|
2023-03-04 21:05:55 -07:00
|
|
|
BUG_ON(insert->k.u64s > ck->u64s);
|
2019-03-07 17:46:10 -07:00
|
|
|
|
|
|
|
bkey_copy(ck->k, insert);
|
|
|
|
|
|
|
|
if (!test_bit(BKEY_CACHED_DIRTY, &ck->flags)) {
|
2023-11-26 15:05:02 -07:00
|
|
|
EBUG_ON(test_bit(BCH_FS_clean_shutdown, &c->flags));
|
2019-03-07 17:46:10 -07:00
|
|
|
set_bit(BKEY_CACHED_DIRTY, &ck->flags);
|
2021-03-24 20:37:33 -07:00
|
|
|
atomic_long_inc(&c->btree_key_cache.nr_dirty);
|
2020-11-19 17:54:40 -07:00
|
|
|
|
|
|
|
if (bch2_nr_btree_keys_need_flush(c))
|
|
|
|
kick_reclaim = true;
|
2019-03-07 17:46:10 -07:00
|
|
|
}
|
|
|
|
|
bcachefs: don't bump key cache journal seq on nojournal commits
fstest generic/388 occasionally reproduces corruptions where an
inode has extents beyond i_size. This is a deliberate crash and
recovery test, and the post crash+recovery characteristics are
usually the same: the inode exists on disk in an early (i.e. just
allocated) state based on the journal sequence number associated
with the inode. Subsequent inode updates exist in the journal at
higher sequence numbers, but the inode hadn't been written back
before the associated crash and the post-crash recovery processes a
set of journal sequence numbers that doesn't include updates to the
inode. In fact, the sequence with the most recent inode key update
always happens to be the sequence just before the front of the
journal processed by recovery.
This last bit is a significant hint that the problem relates to an
on-disk journal update of the front of the journal. The root cause
of this problem is basically that the inode is updated (multiple
times) in-core and in the key cache, each time bumping the key cache
sequence number used to control the cache flush. The cache flush
skips one or more times, bumping the associated key cache journal
pin to the key cache seq value. This has a side effect of holding
the inode in memory a bit longer than normal, which helps exacerbate
this problem, but is also unsafe in certain cases where the key
cache seq may have been updated by a transaction commit that didn't
journal the associated key.
For example, consider an inode that has been allocated, updated
several times in the key cache, journaled, but not yet written back.
At this stage, everything should be consistent if the fs happens to
crash because the latest update has been journal. Now consider a key
update via bch2_extent_update_i_size_sectors() that uses the
BTREE_UPDATE_NOJOURNAL flag. While this update may not change inode
state, it can have the side effect of bumping ck->seq in
bch2_btree_insert_key_cached(). In turn, if a subsequent key cache
flush skips due to seq not matching the former, the ck->journal pin
is updated to ck->seq even though the most recent key update was not
journaled. If this pin happens to reside at the front (tail) of the
journal, this means a subsequent journal write can update last_seq
to a value beyond that which includes the most recent update to the
inode. If this occurs and the fs happens to crash before the inode
happens to flush, recovery will see the latest last_seq, fail to
recover the inode and leave the inode in the inconsistent state
described above.
To avoid this problem, skip the key cache seq update on NOJOURNAL
commits, except on initial pin add. Pass the insert entry directly
to bch2_btree_insert_key_cached() to make the associated flag
available and be consistent with btree_insert_key_leaf().
Signed-off-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-03-02 07:03:37 -07:00
|
|
|
/*
|
|
|
|
* To minimize lock contention, we only add the journal pin here and
|
|
|
|
* defer pin updates to the flush callback via ->seq. Be careful not to
|
|
|
|
* update ->seq on nojournal commits because we don't want to update the
|
|
|
|
* pin to a seq that doesn't include journal updates on disk. Otherwise
|
|
|
|
* we risk losing the update after a crash.
|
|
|
|
*
|
|
|
|
* The only exception is if the pin is not active in the first place. We
|
|
|
|
* have to add the pin because journal reclaim drives key cache
|
|
|
|
* flushing. The flush callback will not proceed unless ->seq matches
|
|
|
|
* the latest pin, so make sure it starts with a consistent value.
|
|
|
|
*/
|
2024-04-07 15:05:34 -07:00
|
|
|
if (!(insert_entry->flags & BTREE_UPDATE_nojournal) ||
|
bcachefs: don't bump key cache journal seq on nojournal commits
fstest generic/388 occasionally reproduces corruptions where an
inode has extents beyond i_size. This is a deliberate crash and
recovery test, and the post crash+recovery characteristics are
usually the same: the inode exists on disk in an early (i.e. just
allocated) state based on the journal sequence number associated
with the inode. Subsequent inode updates exist in the journal at
higher sequence numbers, but the inode hadn't been written back
before the associated crash and the post-crash recovery processes a
set of journal sequence numbers that doesn't include updates to the
inode. In fact, the sequence with the most recent inode key update
always happens to be the sequence just before the front of the
journal processed by recovery.
This last bit is a significant hint that the problem relates to an
on-disk journal update of the front of the journal. The root cause
of this problem is basically that the inode is updated (multiple
times) in-core and in the key cache, each time bumping the key cache
sequence number used to control the cache flush. The cache flush
skips one or more times, bumping the associated key cache journal
pin to the key cache seq value. This has a side effect of holding
the inode in memory a bit longer than normal, which helps exacerbate
this problem, but is also unsafe in certain cases where the key
cache seq may have been updated by a transaction commit that didn't
journal the associated key.
For example, consider an inode that has been allocated, updated
several times in the key cache, journaled, but not yet written back.
At this stage, everything should be consistent if the fs happens to
crash because the latest update has been journal. Now consider a key
update via bch2_extent_update_i_size_sectors() that uses the
BTREE_UPDATE_NOJOURNAL flag. While this update may not change inode
state, it can have the side effect of bumping ck->seq in
bch2_btree_insert_key_cached(). In turn, if a subsequent key cache
flush skips due to seq not matching the former, the ck->journal pin
is updated to ck->seq even though the most recent key update was not
journaled. If this pin happens to reside at the front (tail) of the
journal, this means a subsequent journal write can update last_seq
to a value beyond that which includes the most recent update to the
inode. If this occurs and the fs happens to crash before the inode
happens to flush, recovery will see the latest last_seq, fail to
recover the inode and leave the inode in the inconsistent state
described above.
To avoid this problem, skip the key cache seq update on NOJOURNAL
commits, except on initial pin add. Pass the insert entry directly
to bch2_btree_insert_key_cached() to make the associated flag
available and be consistent with btree_insert_key_leaf().
Signed-off-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-03-02 07:03:37 -07:00
|
|
|
!journal_pin_active(&ck->journal)) {
|
|
|
|
ck->seq = trans->journal_res.seq;
|
|
|
|
}
|
2023-01-04 02:34:16 -07:00
|
|
|
bch2_journal_pin_add(&c->journal, trans->journal_res.seq,
|
|
|
|
&ck->journal, bch2_btree_key_cache_journal_flush);
|
2020-11-19 17:54:40 -07:00
|
|
|
|
|
|
|
if (kick_reclaim)
|
2020-11-19 18:55:33 -07:00
|
|
|
journal_reclaim_kick(&c->journal);
|
2019-03-07 17:46:10 -07:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2022-01-11 23:14:47 -07:00
|
|
|
void bch2_btree_key_cache_drop(struct btree_trans *trans,
|
|
|
|
struct btree_path *path)
|
2019-03-07 17:46:10 -07:00
|
|
|
{
|
2022-08-11 18:06:43 -07:00
|
|
|
struct bch_fs *c = trans->c;
|
2024-06-08 12:20:53 -07:00
|
|
|
struct btree_key_cache *bc = &c->btree_key_cache;
|
2022-01-11 23:14:47 -07:00
|
|
|
struct bkey_cached *ck = (void *) path->l[0].b;
|
|
|
|
|
2022-08-11 18:06:43 -07:00
|
|
|
/*
|
|
|
|
* We just did an update to the btree, bypassing the key cache: the key
|
|
|
|
* cache key is now stale and must be dropped, even if dirty:
|
|
|
|
*/
|
|
|
|
if (test_bit(BKEY_CACHED_DIRTY, &ck->flags)) {
|
|
|
|
clear_bit(BKEY_CACHED_DIRTY, &ck->flags);
|
|
|
|
atomic_long_dec(&c->btree_key_cache.nr_dirty);
|
|
|
|
bch2_journal_pin_drop(&c->journal, &ck->journal);
|
|
|
|
}
|
|
|
|
|
2024-06-08 12:20:53 -07:00
|
|
|
bkey_cached_evict(bc, ck);
|
2024-06-08 19:32:40 -07:00
|
|
|
bkey_cached_free(bc, ck);
|
2024-06-08 12:20:53 -07:00
|
|
|
|
|
|
|
mark_btree_node_locked(trans, path, 0, BTREE_NODE_UNLOCKED);
|
|
|
|
btree_path_set_dirty(path, BTREE_ITER_NEED_TRAVERSE);
|
2024-08-21 23:13:02 -07:00
|
|
|
path->should_be_locked = false;
|
2019-03-07 17:46:10 -07:00
|
|
|
}
|
|
|
|
|
2020-11-12 15:19:47 -07:00
|
|
|
static unsigned long bch2_btree_key_cache_scan(struct shrinker *shrink,
|
|
|
|
struct shrink_control *sc)
|
|
|
|
{
|
Many singleton patches against the MM code. The patch series which are
included in this merge do the following:
- Kemeng Shi has contributed some compation maintenance work in the
series "Fixes and cleanups to compaction".
- Joel Fernandes has a patchset ("Optimize mremap during mutual
alignment within PMD") which fixes an obscure issue with mremap()'s
pagetable handling during a subsequent exec(), based upon an
implementation which Linus suggested.
- More DAMON/DAMOS maintenance and feature work from SeongJae Park i the
following patch series:
mm/damon: misc fixups for documents, comments and its tracepoint
mm/damon: add a tracepoint for damos apply target regions
mm/damon: provide pseudo-moving sum based access rate
mm/damon: implement DAMOS apply intervals
mm/damon/core-test: Fix memory leaks in core-test
mm/damon/sysfs-schemes: Do DAMOS tried regions update for only one apply interval
- In the series "Do not try to access unaccepted memory" Adrian Hunter
provides some fixups for the recently-added "unaccepted memory' feature.
To increase the feature's checking coverage. "Plug a few gaps where
RAM is exposed without checking if it is unaccepted memory".
- In the series "cleanups for lockless slab shrink" Qi Zheng has done
some maintenance work which is preparation for the lockless slab
shrinking code.
- Qi Zheng has redone the earlier (and reverted) attempt to make slab
shrinking lockless in the series "use refcount+RCU method to implement
lockless slab shrink".
- David Hildenbrand contributes some maintenance work for the rmap code
in the series "Anon rmap cleanups".
- Kefeng Wang does more folio conversions and some maintenance work in
the migration code. Series "mm: migrate: more folio conversion and
unification".
- Matthew Wilcox has fixed an issue in the buffer_head code which was
causing long stalls under some heavy memory/IO loads. Some cleanups
were added on the way. Series "Add and use bdev_getblk()".
- In the series "Use nth_page() in place of direct struct page
manipulation" Zi Yan has fixed a potential issue with the direct
manipulation of hugetlb page frames.
- In the series "mm: hugetlb: Skip initialization of gigantic tail
struct pages if freed by HVO" has improved our handling of gigantic
pages in the hugetlb vmmemmep optimizaton code. This provides
significant boot time improvements when significant amounts of gigantic
pages are in use.
- Matthew Wilcox has sent the series "Small hugetlb cleanups" - code
rationalization and folio conversions in the hugetlb code.
- Yin Fengwei has improved mlock()'s handling of large folios in the
series "support large folio for mlock"
- In the series "Expose swapcache stat for memcg v1" Liu Shixin has
added statistics for memcg v1 users which are available (and useful)
under memcg v2.
- Florent Revest has enhanced the MDWE (Memory-Deny-Write-Executable)
prctl so that userspace may direct the kernel to not automatically
propagate the denial to child processes. The series is named "MDWE
without inheritance".
- Kefeng Wang has provided the series "mm: convert numa balancing
functions to use a folio" which does what it says.
- In the series "mm/ksm: add fork-exec support for prctl" Stefan Roesch
makes is possible for a process to propagate KSM treatment across
exec().
- Huang Ying has enhanced memory tiering's calculation of memory
distances. This is used to permit the dax/kmem driver to use "high
bandwidth memory" in addition to Optane Data Center Persistent Memory
Modules (DCPMM). The series is named "memory tiering: calculate
abstract distance based on ACPI HMAT"
- In the series "Smart scanning mode for KSM" Stefan Roesch has
optimized KSM by teaching it to retain and use some historical
information from previous scans.
- Yosry Ahmed has fixed some inconsistencies in memcg statistics in the
series "mm: memcg: fix tracking of pending stats updates values".
- In the series "Implement IOCTL to get and optionally clear info about
PTEs" Peter Xu has added an ioctl to /proc/<pid>/pagemap which permits
us to atomically read-then-clear page softdirty state. This is mainly
used by CRIU.
- Hugh Dickins contributed the series "shmem,tmpfs: general maintenance"
- a bunch of relatively minor maintenance tweaks to this code.
- Matthew Wilcox has increased the use of the VMA lock over file-backed
page faults in the series "Handle more faults under the VMA lock". Some
rationalizations of the fault path became possible as a result.
- In the series "mm/rmap: convert page_move_anon_rmap() to
folio_move_anon_rmap()" David Hildenbrand has implemented some cleanups
and folio conversions.
- In the series "various improvements to the GUP interface" Lorenzo
Stoakes has simplified and improved the GUP interface with an eye to
providing groundwork for future improvements.
- Andrey Konovalov has sent along the series "kasan: assorted fixes and
improvements" which does those things.
- Some page allocator maintenance work from Kemeng Shi in the series
"Two minor cleanups to break_down_buddy_pages".
- In thes series "New selftest for mm" Breno Leitao has developed
another MM self test which tickles a race we had between madvise() and
page faults.
- In the series "Add folio_end_read" Matthew Wilcox provides cleanups
and an optimization to the core pagecache code.
- Nhat Pham has added memcg accounting for hugetlb memory in the series
"hugetlb memcg accounting".
- Cleanups and rationalizations to the pagemap code from Lorenzo
Stoakes, in the series "Abstract vma_merge() and split_vma()".
- Audra Mitchell has fixed issues in the procfs page_owner code's new
timestamping feature which was causing some misbehaviours. In the
series "Fix page_owner's use of free timestamps".
- Lorenzo Stoakes has fixed the handling of new mappings of sealed files
in the series "permit write-sealed memfd read-only shared mappings".
- Mike Kravetz has optimized the hugetlb vmemmap optimization in the
series "Batch hugetlb vmemmap modification operations".
- Some buffer_head folio conversions and cleanups from Matthew Wilcox in
the series "Finish the create_empty_buffers() transition".
- As a page allocator performance optimization Huang Ying has added
automatic tuning to the allocator's per-cpu-pages feature, in the series
"mm: PCP high auto-tuning".
- Roman Gushchin has contributed the patchset "mm: improve performance
of accounted kernel memory allocations" which improves their performance
by ~30% as measured by a micro-benchmark.
- folio conversions from Kefeng Wang in the series "mm: convert page
cpupid functions to folios".
- Some kmemleak fixups in Liu Shixin's series "Some bugfix about
kmemleak".
- Qi Zheng has improved our handling of memoryless nodes by keeping them
off the allocation fallback list. This is done in the series "handle
memoryless nodes more appropriately".
- khugepaged conversions from Vishal Moola in the series "Some
khugepaged folio conversions".
-----BEGIN PGP SIGNATURE-----
iHUEABYIAB0WIQTTMBEPP41GrTpTJgfdBJ7gKXxAjgUCZULEMwAKCRDdBJ7gKXxA
jhQHAQCYpD3g849x69DmHnHWHm/EHQLvQmRMDeYZI+nx/sCJOwEAw4AKg0Oemv9y
FgeUPAD1oasg6CP+INZvCj34waNxwAc=
=E+Y4
-----END PGP SIGNATURE-----
Merge tag 'mm-stable-2023-11-01-14-33' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Pull MM updates from Andrew Morton:
"Many singleton patches against the MM code. The patch series which are
included in this merge do the following:
- Kemeng Shi has contributed some compation maintenance work in the
series 'Fixes and cleanups to compaction'
- Joel Fernandes has a patchset ('Optimize mremap during mutual
alignment within PMD') which fixes an obscure issue with mremap()'s
pagetable handling during a subsequent exec(), based upon an
implementation which Linus suggested
- More DAMON/DAMOS maintenance and feature work from SeongJae Park i
the following patch series:
mm/damon: misc fixups for documents, comments and its tracepoint
mm/damon: add a tracepoint for damos apply target regions
mm/damon: provide pseudo-moving sum based access rate
mm/damon: implement DAMOS apply intervals
mm/damon/core-test: Fix memory leaks in core-test
mm/damon/sysfs-schemes: Do DAMOS tried regions update for only one apply interval
- In the series 'Do not try to access unaccepted memory' Adrian
Hunter provides some fixups for the recently-added 'unaccepted
memory' feature. To increase the feature's checking coverage. 'Plug
a few gaps where RAM is exposed without checking if it is
unaccepted memory'
- In the series 'cleanups for lockless slab shrink' Qi Zheng has done
some maintenance work which is preparation for the lockless slab
shrinking code
- Qi Zheng has redone the earlier (and reverted) attempt to make slab
shrinking lockless in the series 'use refcount+RCU method to
implement lockless slab shrink'
- David Hildenbrand contributes some maintenance work for the rmap
code in the series 'Anon rmap cleanups'
- Kefeng Wang does more folio conversions and some maintenance work
in the migration code. Series 'mm: migrate: more folio conversion
and unification'
- Matthew Wilcox has fixed an issue in the buffer_head code which was
causing long stalls under some heavy memory/IO loads. Some cleanups
were added on the way. Series 'Add and use bdev_getblk()'
- In the series 'Use nth_page() in place of direct struct page
manipulation' Zi Yan has fixed a potential issue with the direct
manipulation of hugetlb page frames
- In the series 'mm: hugetlb: Skip initialization of gigantic tail
struct pages if freed by HVO' has improved our handling of gigantic
pages in the hugetlb vmmemmep optimizaton code. This provides
significant boot time improvements when significant amounts of
gigantic pages are in use
- Matthew Wilcox has sent the series 'Small hugetlb cleanups' - code
rationalization and folio conversions in the hugetlb code
- Yin Fengwei has improved mlock()'s handling of large folios in the
series 'support large folio for mlock'
- In the series 'Expose swapcache stat for memcg v1' Liu Shixin has
added statistics for memcg v1 users which are available (and
useful) under memcg v2
- Florent Revest has enhanced the MDWE (Memory-Deny-Write-Executable)
prctl so that userspace may direct the kernel to not automatically
propagate the denial to child processes. The series is named 'MDWE
without inheritance'
- Kefeng Wang has provided the series 'mm: convert numa balancing
functions to use a folio' which does what it says
- In the series 'mm/ksm: add fork-exec support for prctl' Stefan
Roesch makes is possible for a process to propagate KSM treatment
across exec()
- Huang Ying has enhanced memory tiering's calculation of memory
distances. This is used to permit the dax/kmem driver to use 'high
bandwidth memory' in addition to Optane Data Center Persistent
Memory Modules (DCPMM). The series is named 'memory tiering:
calculate abstract distance based on ACPI HMAT'
- In the series 'Smart scanning mode for KSM' Stefan Roesch has
optimized KSM by teaching it to retain and use some historical
information from previous scans
- Yosry Ahmed has fixed some inconsistencies in memcg statistics in
the series 'mm: memcg: fix tracking of pending stats updates
values'
- In the series 'Implement IOCTL to get and optionally clear info
about PTEs' Peter Xu has added an ioctl to /proc/<pid>/pagemap
which permits us to atomically read-then-clear page softdirty
state. This is mainly used by CRIU
- Hugh Dickins contributed the series 'shmem,tmpfs: general
maintenance', a bunch of relatively minor maintenance tweaks to
this code
- Matthew Wilcox has increased the use of the VMA lock over
file-backed page faults in the series 'Handle more faults under the
VMA lock'. Some rationalizations of the fault path became possible
as a result
- In the series 'mm/rmap: convert page_move_anon_rmap() to
folio_move_anon_rmap()' David Hildenbrand has implemented some
cleanups and folio conversions
- In the series 'various improvements to the GUP interface' Lorenzo
Stoakes has simplified and improved the GUP interface with an eye
to providing groundwork for future improvements
- Andrey Konovalov has sent along the series 'kasan: assorted fixes
and improvements' which does those things
- Some page allocator maintenance work from Kemeng Shi in the series
'Two minor cleanups to break_down_buddy_pages'
- In thes series 'New selftest for mm' Breno Leitao has developed
another MM self test which tickles a race we had between madvise()
and page faults
- In the series 'Add folio_end_read' Matthew Wilcox provides cleanups
and an optimization to the core pagecache code
- Nhat Pham has added memcg accounting for hugetlb memory in the
series 'hugetlb memcg accounting'
- Cleanups and rationalizations to the pagemap code from Lorenzo
Stoakes, in the series 'Abstract vma_merge() and split_vma()'
- Audra Mitchell has fixed issues in the procfs page_owner code's new
timestamping feature which was causing some misbehaviours. In the
series 'Fix page_owner's use of free timestamps'
- Lorenzo Stoakes has fixed the handling of new mappings of sealed
files in the series 'permit write-sealed memfd read-only shared
mappings'
- Mike Kravetz has optimized the hugetlb vmemmap optimization in the
series 'Batch hugetlb vmemmap modification operations'
- Some buffer_head folio conversions and cleanups from Matthew Wilcox
in the series 'Finish the create_empty_buffers() transition'
- As a page allocator performance optimization Huang Ying has added
automatic tuning to the allocator's per-cpu-pages feature, in the
series 'mm: PCP high auto-tuning'
- Roman Gushchin has contributed the patchset 'mm: improve
performance of accounted kernel memory allocations' which improves
their performance by ~30% as measured by a micro-benchmark
- folio conversions from Kefeng Wang in the series 'mm: convert page
cpupid functions to folios'
- Some kmemleak fixups in Liu Shixin's series 'Some bugfix about
kmemleak'
- Qi Zheng has improved our handling of memoryless nodes by keeping
them off the allocation fallback list. This is done in the series
'handle memoryless nodes more appropriately'
- khugepaged conversions from Vishal Moola in the series 'Some
khugepaged folio conversions'"
[ bcachefs conflicts with the dynamically allocated shrinkers have been
resolved as per Stephen Rothwell in
https://lore.kernel.org/all/20230913093553.4290421e@canb.auug.org.au/
with help from Qi Zheng.
The clone3 test filtering conflict was half-arsed by yours truly ]
* tag 'mm-stable-2023-11-01-14-33' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm: (406 commits)
mm/damon/sysfs: update monitoring target regions for online input commit
mm/damon/sysfs: remove requested targets when online-commit inputs
selftests: add a sanity check for zswap
Documentation: maple_tree: fix word spelling error
mm/vmalloc: fix the unchecked dereference warning in vread_iter()
zswap: export compression failure stats
Documentation: ubsan: drop "the" from article title
mempolicy: migration attempt to match interleave nodes
mempolicy: mmap_lock is not needed while migrating folios
mempolicy: alloc_pages_mpol() for NUMA policy without vma
mm: add page_rmappable_folio() wrapper
mempolicy: remove confusing MPOL_MF_LAZY dead code
mempolicy: mpol_shared_policy_init() without pseudo-vma
mempolicy trivia: use pgoff_t in shared mempolicy tree
mempolicy trivia: slightly more consistent naming
mempolicy trivia: delete those ancient pr_debug()s
mempolicy: fix migrate_pages(2) syscall return nr_failed
kernfs: drop shared NUMA mempolicy hooks
hugetlbfs: drop shared NUMA mempolicy pretence
mm/damon/sysfs-test: add a unit test for damon_sysfs_set_targets()
...
2023-11-02 22:38:47 -07:00
|
|
|
struct bch_fs *c = shrink->private_data;
|
2020-11-12 15:19:47 -07:00
|
|
|
struct btree_key_cache *bc = &c->btree_key_cache;
|
2021-03-24 20:37:33 -07:00
|
|
|
struct bucket_table *tbl;
|
2024-06-08 19:32:40 -07:00
|
|
|
struct bkey_cached *ck;
|
2020-11-12 15:19:47 -07:00
|
|
|
size_t scanned = 0, freed = 0, nr = sc->nr_to_scan;
|
2024-06-08 19:32:40 -07:00
|
|
|
unsigned iter, start;
|
2021-03-24 20:37:33 -07:00
|
|
|
int srcu_idx;
|
2020-11-12 15:19:47 -07:00
|
|
|
|
2021-03-24 20:37:33 -07:00
|
|
|
srcu_idx = srcu_read_lock(&c->btree_trans_barrier);
|
|
|
|
rcu_read_lock();
|
2024-06-08 19:32:40 -07:00
|
|
|
|
2021-03-24 20:37:33 -07:00
|
|
|
tbl = rht_dereference_rcu(bc->table.tbl, &bc->table);
|
2024-08-19 13:41:00 -07:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Scanning is expensive while a rehash is in progress - most elements
|
|
|
|
* will be on the new hashtable, if it's in progress
|
|
|
|
*
|
|
|
|
* A rehash could still start while we're scanning - that's ok, we'll
|
|
|
|
* still see most elements.
|
|
|
|
*/
|
|
|
|
if (unlikely(tbl->nest)) {
|
|
|
|
rcu_read_unlock();
|
|
|
|
srcu_read_unlock(&c->btree_trans_barrier, srcu_idx);
|
|
|
|
return SHRINK_STOP;
|
|
|
|
}
|
|
|
|
|
2024-06-08 19:32:40 -07:00
|
|
|
iter = bc->shrink_iter;
|
|
|
|
if (iter >= tbl->size)
|
|
|
|
iter = 0;
|
|
|
|
start = iter;
|
2020-11-12 15:19:47 -07:00
|
|
|
|
2021-03-24 20:37:33 -07:00
|
|
|
do {
|
|
|
|
struct rhash_head *pos, *next;
|
|
|
|
|
2024-06-08 19:32:40 -07:00
|
|
|
pos = rht_ptr_rcu(&tbl->buckets[iter]);
|
2021-03-24 20:37:33 -07:00
|
|
|
|
|
|
|
while (!rht_is_a_nulls(pos)) {
|
2024-06-08 19:32:40 -07:00
|
|
|
next = rht_dereference_bucket_rcu(pos->next, tbl, iter);
|
2021-03-24 20:37:33 -07:00
|
|
|
ck = container_of(pos, struct bkey_cached, hash);
|
|
|
|
|
2024-04-20 12:35:40 -07:00
|
|
|
if (test_bit(BKEY_CACHED_DIRTY, &ck->flags)) {
|
2024-04-20 11:49:22 -07:00
|
|
|
bc->skipped_dirty++;
|
2024-04-20 12:35:40 -07:00
|
|
|
} else if (test_bit(BKEY_CACHED_ACCESSED, &ck->flags)) {
|
2021-03-24 20:37:33 -07:00
|
|
|
clear_bit(BKEY_CACHED_ACCESSED, &ck->flags);
|
2024-04-20 11:49:22 -07:00
|
|
|
bc->skipped_accessed++;
|
2024-06-06 17:01:34 -07:00
|
|
|
} else if (!bkey_cached_lock_for_evict(ck)) {
|
|
|
|
bc->skipped_lock_fail++;
|
2024-06-08 19:32:40 -07:00
|
|
|
} else if (bkey_cached_evict(bc, ck)) {
|
2021-03-24 20:37:33 -07:00
|
|
|
bkey_cached_free(bc, ck);
|
2024-06-08 19:32:40 -07:00
|
|
|
bc->freed++;
|
2024-06-06 17:01:34 -07:00
|
|
|
freed++;
|
2024-06-08 19:32:40 -07:00
|
|
|
} else {
|
|
|
|
six_unlock_write(&ck->c.lock);
|
|
|
|
six_unlock_intent(&ck->c.lock);
|
2021-03-24 20:37:33 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
scanned++;
|
|
|
|
if (scanned >= nr)
|
2024-06-08 19:32:40 -07:00
|
|
|
goto out;
|
2024-06-06 17:01:34 -07:00
|
|
|
|
2021-03-24 20:37:33 -07:00
|
|
|
pos = next;
|
2020-11-12 15:19:47 -07:00
|
|
|
}
|
2021-03-24 20:37:33 -07:00
|
|
|
|
2024-06-08 19:32:40 -07:00
|
|
|
iter++;
|
|
|
|
if (iter >= tbl->size)
|
|
|
|
iter = 0;
|
|
|
|
} while (scanned < nr && iter != start);
|
|
|
|
out:
|
|
|
|
bc->shrink_iter = iter;
|
2021-03-24 20:37:33 -07:00
|
|
|
|
|
|
|
rcu_read_unlock();
|
|
|
|
srcu_read_unlock(&c->btree_trans_barrier, srcu_idx);
|
2020-11-12 15:19:47 -07:00
|
|
|
|
|
|
|
return freed;
|
|
|
|
}
|
|
|
|
|
|
|
|
static unsigned long bch2_btree_key_cache_count(struct shrinker *shrink,
|
|
|
|
struct shrink_control *sc)
|
|
|
|
{
|
Many singleton patches against the MM code. The patch series which are
included in this merge do the following:
- Kemeng Shi has contributed some compation maintenance work in the
series "Fixes and cleanups to compaction".
- Joel Fernandes has a patchset ("Optimize mremap during mutual
alignment within PMD") which fixes an obscure issue with mremap()'s
pagetable handling during a subsequent exec(), based upon an
implementation which Linus suggested.
- More DAMON/DAMOS maintenance and feature work from SeongJae Park i the
following patch series:
mm/damon: misc fixups for documents, comments and its tracepoint
mm/damon: add a tracepoint for damos apply target regions
mm/damon: provide pseudo-moving sum based access rate
mm/damon: implement DAMOS apply intervals
mm/damon/core-test: Fix memory leaks in core-test
mm/damon/sysfs-schemes: Do DAMOS tried regions update for only one apply interval
- In the series "Do not try to access unaccepted memory" Adrian Hunter
provides some fixups for the recently-added "unaccepted memory' feature.
To increase the feature's checking coverage. "Plug a few gaps where
RAM is exposed without checking if it is unaccepted memory".
- In the series "cleanups for lockless slab shrink" Qi Zheng has done
some maintenance work which is preparation for the lockless slab
shrinking code.
- Qi Zheng has redone the earlier (and reverted) attempt to make slab
shrinking lockless in the series "use refcount+RCU method to implement
lockless slab shrink".
- David Hildenbrand contributes some maintenance work for the rmap code
in the series "Anon rmap cleanups".
- Kefeng Wang does more folio conversions and some maintenance work in
the migration code. Series "mm: migrate: more folio conversion and
unification".
- Matthew Wilcox has fixed an issue in the buffer_head code which was
causing long stalls under some heavy memory/IO loads. Some cleanups
were added on the way. Series "Add and use bdev_getblk()".
- In the series "Use nth_page() in place of direct struct page
manipulation" Zi Yan has fixed a potential issue with the direct
manipulation of hugetlb page frames.
- In the series "mm: hugetlb: Skip initialization of gigantic tail
struct pages if freed by HVO" has improved our handling of gigantic
pages in the hugetlb vmmemmep optimizaton code. This provides
significant boot time improvements when significant amounts of gigantic
pages are in use.
- Matthew Wilcox has sent the series "Small hugetlb cleanups" - code
rationalization and folio conversions in the hugetlb code.
- Yin Fengwei has improved mlock()'s handling of large folios in the
series "support large folio for mlock"
- In the series "Expose swapcache stat for memcg v1" Liu Shixin has
added statistics for memcg v1 users which are available (and useful)
under memcg v2.
- Florent Revest has enhanced the MDWE (Memory-Deny-Write-Executable)
prctl so that userspace may direct the kernel to not automatically
propagate the denial to child processes. The series is named "MDWE
without inheritance".
- Kefeng Wang has provided the series "mm: convert numa balancing
functions to use a folio" which does what it says.
- In the series "mm/ksm: add fork-exec support for prctl" Stefan Roesch
makes is possible for a process to propagate KSM treatment across
exec().
- Huang Ying has enhanced memory tiering's calculation of memory
distances. This is used to permit the dax/kmem driver to use "high
bandwidth memory" in addition to Optane Data Center Persistent Memory
Modules (DCPMM). The series is named "memory tiering: calculate
abstract distance based on ACPI HMAT"
- In the series "Smart scanning mode for KSM" Stefan Roesch has
optimized KSM by teaching it to retain and use some historical
information from previous scans.
- Yosry Ahmed has fixed some inconsistencies in memcg statistics in the
series "mm: memcg: fix tracking of pending stats updates values".
- In the series "Implement IOCTL to get and optionally clear info about
PTEs" Peter Xu has added an ioctl to /proc/<pid>/pagemap which permits
us to atomically read-then-clear page softdirty state. This is mainly
used by CRIU.
- Hugh Dickins contributed the series "shmem,tmpfs: general maintenance"
- a bunch of relatively minor maintenance tweaks to this code.
- Matthew Wilcox has increased the use of the VMA lock over file-backed
page faults in the series "Handle more faults under the VMA lock". Some
rationalizations of the fault path became possible as a result.
- In the series "mm/rmap: convert page_move_anon_rmap() to
folio_move_anon_rmap()" David Hildenbrand has implemented some cleanups
and folio conversions.
- In the series "various improvements to the GUP interface" Lorenzo
Stoakes has simplified and improved the GUP interface with an eye to
providing groundwork for future improvements.
- Andrey Konovalov has sent along the series "kasan: assorted fixes and
improvements" which does those things.
- Some page allocator maintenance work from Kemeng Shi in the series
"Two minor cleanups to break_down_buddy_pages".
- In thes series "New selftest for mm" Breno Leitao has developed
another MM self test which tickles a race we had between madvise() and
page faults.
- In the series "Add folio_end_read" Matthew Wilcox provides cleanups
and an optimization to the core pagecache code.
- Nhat Pham has added memcg accounting for hugetlb memory in the series
"hugetlb memcg accounting".
- Cleanups and rationalizations to the pagemap code from Lorenzo
Stoakes, in the series "Abstract vma_merge() and split_vma()".
- Audra Mitchell has fixed issues in the procfs page_owner code's new
timestamping feature which was causing some misbehaviours. In the
series "Fix page_owner's use of free timestamps".
- Lorenzo Stoakes has fixed the handling of new mappings of sealed files
in the series "permit write-sealed memfd read-only shared mappings".
- Mike Kravetz has optimized the hugetlb vmemmap optimization in the
series "Batch hugetlb vmemmap modification operations".
- Some buffer_head folio conversions and cleanups from Matthew Wilcox in
the series "Finish the create_empty_buffers() transition".
- As a page allocator performance optimization Huang Ying has added
automatic tuning to the allocator's per-cpu-pages feature, in the series
"mm: PCP high auto-tuning".
- Roman Gushchin has contributed the patchset "mm: improve performance
of accounted kernel memory allocations" which improves their performance
by ~30% as measured by a micro-benchmark.
- folio conversions from Kefeng Wang in the series "mm: convert page
cpupid functions to folios".
- Some kmemleak fixups in Liu Shixin's series "Some bugfix about
kmemleak".
- Qi Zheng has improved our handling of memoryless nodes by keeping them
off the allocation fallback list. This is done in the series "handle
memoryless nodes more appropriately".
- khugepaged conversions from Vishal Moola in the series "Some
khugepaged folio conversions".
-----BEGIN PGP SIGNATURE-----
iHUEABYIAB0WIQTTMBEPP41GrTpTJgfdBJ7gKXxAjgUCZULEMwAKCRDdBJ7gKXxA
jhQHAQCYpD3g849x69DmHnHWHm/EHQLvQmRMDeYZI+nx/sCJOwEAw4AKg0Oemv9y
FgeUPAD1oasg6CP+INZvCj34waNxwAc=
=E+Y4
-----END PGP SIGNATURE-----
Merge tag 'mm-stable-2023-11-01-14-33' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Pull MM updates from Andrew Morton:
"Many singleton patches against the MM code. The patch series which are
included in this merge do the following:
- Kemeng Shi has contributed some compation maintenance work in the
series 'Fixes and cleanups to compaction'
- Joel Fernandes has a patchset ('Optimize mremap during mutual
alignment within PMD') which fixes an obscure issue with mremap()'s
pagetable handling during a subsequent exec(), based upon an
implementation which Linus suggested
- More DAMON/DAMOS maintenance and feature work from SeongJae Park i
the following patch series:
mm/damon: misc fixups for documents, comments and its tracepoint
mm/damon: add a tracepoint for damos apply target regions
mm/damon: provide pseudo-moving sum based access rate
mm/damon: implement DAMOS apply intervals
mm/damon/core-test: Fix memory leaks in core-test
mm/damon/sysfs-schemes: Do DAMOS tried regions update for only one apply interval
- In the series 'Do not try to access unaccepted memory' Adrian
Hunter provides some fixups for the recently-added 'unaccepted
memory' feature. To increase the feature's checking coverage. 'Plug
a few gaps where RAM is exposed without checking if it is
unaccepted memory'
- In the series 'cleanups for lockless slab shrink' Qi Zheng has done
some maintenance work which is preparation for the lockless slab
shrinking code
- Qi Zheng has redone the earlier (and reverted) attempt to make slab
shrinking lockless in the series 'use refcount+RCU method to
implement lockless slab shrink'
- David Hildenbrand contributes some maintenance work for the rmap
code in the series 'Anon rmap cleanups'
- Kefeng Wang does more folio conversions and some maintenance work
in the migration code. Series 'mm: migrate: more folio conversion
and unification'
- Matthew Wilcox has fixed an issue in the buffer_head code which was
causing long stalls under some heavy memory/IO loads. Some cleanups
were added on the way. Series 'Add and use bdev_getblk()'
- In the series 'Use nth_page() in place of direct struct page
manipulation' Zi Yan has fixed a potential issue with the direct
manipulation of hugetlb page frames
- In the series 'mm: hugetlb: Skip initialization of gigantic tail
struct pages if freed by HVO' has improved our handling of gigantic
pages in the hugetlb vmmemmep optimizaton code. This provides
significant boot time improvements when significant amounts of
gigantic pages are in use
- Matthew Wilcox has sent the series 'Small hugetlb cleanups' - code
rationalization and folio conversions in the hugetlb code
- Yin Fengwei has improved mlock()'s handling of large folios in the
series 'support large folio for mlock'
- In the series 'Expose swapcache stat for memcg v1' Liu Shixin has
added statistics for memcg v1 users which are available (and
useful) under memcg v2
- Florent Revest has enhanced the MDWE (Memory-Deny-Write-Executable)
prctl so that userspace may direct the kernel to not automatically
propagate the denial to child processes. The series is named 'MDWE
without inheritance'
- Kefeng Wang has provided the series 'mm: convert numa balancing
functions to use a folio' which does what it says
- In the series 'mm/ksm: add fork-exec support for prctl' Stefan
Roesch makes is possible for a process to propagate KSM treatment
across exec()
- Huang Ying has enhanced memory tiering's calculation of memory
distances. This is used to permit the dax/kmem driver to use 'high
bandwidth memory' in addition to Optane Data Center Persistent
Memory Modules (DCPMM). The series is named 'memory tiering:
calculate abstract distance based on ACPI HMAT'
- In the series 'Smart scanning mode for KSM' Stefan Roesch has
optimized KSM by teaching it to retain and use some historical
information from previous scans
- Yosry Ahmed has fixed some inconsistencies in memcg statistics in
the series 'mm: memcg: fix tracking of pending stats updates
values'
- In the series 'Implement IOCTL to get and optionally clear info
about PTEs' Peter Xu has added an ioctl to /proc/<pid>/pagemap
which permits us to atomically read-then-clear page softdirty
state. This is mainly used by CRIU
- Hugh Dickins contributed the series 'shmem,tmpfs: general
maintenance', a bunch of relatively minor maintenance tweaks to
this code
- Matthew Wilcox has increased the use of the VMA lock over
file-backed page faults in the series 'Handle more faults under the
VMA lock'. Some rationalizations of the fault path became possible
as a result
- In the series 'mm/rmap: convert page_move_anon_rmap() to
folio_move_anon_rmap()' David Hildenbrand has implemented some
cleanups and folio conversions
- In the series 'various improvements to the GUP interface' Lorenzo
Stoakes has simplified and improved the GUP interface with an eye
to providing groundwork for future improvements
- Andrey Konovalov has sent along the series 'kasan: assorted fixes
and improvements' which does those things
- Some page allocator maintenance work from Kemeng Shi in the series
'Two minor cleanups to break_down_buddy_pages'
- In thes series 'New selftest for mm' Breno Leitao has developed
another MM self test which tickles a race we had between madvise()
and page faults
- In the series 'Add folio_end_read' Matthew Wilcox provides cleanups
and an optimization to the core pagecache code
- Nhat Pham has added memcg accounting for hugetlb memory in the
series 'hugetlb memcg accounting'
- Cleanups and rationalizations to the pagemap code from Lorenzo
Stoakes, in the series 'Abstract vma_merge() and split_vma()'
- Audra Mitchell has fixed issues in the procfs page_owner code's new
timestamping feature which was causing some misbehaviours. In the
series 'Fix page_owner's use of free timestamps'
- Lorenzo Stoakes has fixed the handling of new mappings of sealed
files in the series 'permit write-sealed memfd read-only shared
mappings'
- Mike Kravetz has optimized the hugetlb vmemmap optimization in the
series 'Batch hugetlb vmemmap modification operations'
- Some buffer_head folio conversions and cleanups from Matthew Wilcox
in the series 'Finish the create_empty_buffers() transition'
- As a page allocator performance optimization Huang Ying has added
automatic tuning to the allocator's per-cpu-pages feature, in the
series 'mm: PCP high auto-tuning'
- Roman Gushchin has contributed the patchset 'mm: improve
performance of accounted kernel memory allocations' which improves
their performance by ~30% as measured by a micro-benchmark
- folio conversions from Kefeng Wang in the series 'mm: convert page
cpupid functions to folios'
- Some kmemleak fixups in Liu Shixin's series 'Some bugfix about
kmemleak'
- Qi Zheng has improved our handling of memoryless nodes by keeping
them off the allocation fallback list. This is done in the series
'handle memoryless nodes more appropriately'
- khugepaged conversions from Vishal Moola in the series 'Some
khugepaged folio conversions'"
[ bcachefs conflicts with the dynamically allocated shrinkers have been
resolved as per Stephen Rothwell in
https://lore.kernel.org/all/20230913093553.4290421e@canb.auug.org.au/
with help from Qi Zheng.
The clone3 test filtering conflict was half-arsed by yours truly ]
* tag 'mm-stable-2023-11-01-14-33' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm: (406 commits)
mm/damon/sysfs: update monitoring target regions for online input commit
mm/damon/sysfs: remove requested targets when online-commit inputs
selftests: add a sanity check for zswap
Documentation: maple_tree: fix word spelling error
mm/vmalloc: fix the unchecked dereference warning in vread_iter()
zswap: export compression failure stats
Documentation: ubsan: drop "the" from article title
mempolicy: migration attempt to match interleave nodes
mempolicy: mmap_lock is not needed while migrating folios
mempolicy: alloc_pages_mpol() for NUMA policy without vma
mm: add page_rmappable_folio() wrapper
mempolicy: remove confusing MPOL_MF_LAZY dead code
mempolicy: mpol_shared_policy_init() without pseudo-vma
mempolicy trivia: use pgoff_t in shared mempolicy tree
mempolicy trivia: slightly more consistent naming
mempolicy trivia: delete those ancient pr_debug()s
mempolicy: fix migrate_pages(2) syscall return nr_failed
kernfs: drop shared NUMA mempolicy hooks
hugetlbfs: drop shared NUMA mempolicy pretence
mm/damon/sysfs-test: add a unit test for damon_sysfs_set_targets()
...
2023-11-02 22:38:47 -07:00
|
|
|
struct bch_fs *c = shrink->private_data;
|
2020-11-12 15:19:47 -07:00
|
|
|
struct btree_key_cache *bc = &c->btree_key_cache;
|
2021-04-27 11:02:00 -07:00
|
|
|
long nr = atomic_long_read(&bc->nr_keys) -
|
|
|
|
atomic_long_read(&bc->nr_dirty);
|
2020-11-12 15:19:47 -07:00
|
|
|
|
2024-06-07 11:25:18 -07:00
|
|
|
/*
|
|
|
|
* Avoid hammering our shrinker too much if it's nearly empty - the
|
|
|
|
* shrinker code doesn't take into account how big our cache is, if it's
|
|
|
|
* mostly empty but the system is under memory pressure it causes nasty
|
|
|
|
* lock contention:
|
|
|
|
*/
|
|
|
|
nr -= 128;
|
|
|
|
|
2021-04-27 11:02:00 -07:00
|
|
|
return max(0L, nr);
|
2020-11-12 15:19:47 -07:00
|
|
|
}
|
|
|
|
|
2020-11-09 11:01:52 -07:00
|
|
|
void bch2_fs_btree_key_cache_exit(struct btree_key_cache *bc)
|
2019-03-07 17:46:10 -07:00
|
|
|
{
|
2020-11-09 11:01:52 -07:00
|
|
|
struct bch_fs *c = container_of(bc, struct bch_fs, btree_key_cache);
|
2021-03-24 20:37:33 -07:00
|
|
|
struct bucket_table *tbl;
|
2024-06-08 19:32:40 -07:00
|
|
|
struct bkey_cached *ck;
|
2021-03-24 20:37:33 -07:00
|
|
|
struct rhash_head *pos;
|
2023-03-02 21:51:47 -07:00
|
|
|
LIST_HEAD(items);
|
2021-03-24 20:37:33 -07:00
|
|
|
unsigned i;
|
2019-03-07 17:46:10 -07:00
|
|
|
|
Many singleton patches against the MM code. The patch series which are
included in this merge do the following:
- Kemeng Shi has contributed some compation maintenance work in the
series "Fixes and cleanups to compaction".
- Joel Fernandes has a patchset ("Optimize mremap during mutual
alignment within PMD") which fixes an obscure issue with mremap()'s
pagetable handling during a subsequent exec(), based upon an
implementation which Linus suggested.
- More DAMON/DAMOS maintenance and feature work from SeongJae Park i the
following patch series:
mm/damon: misc fixups for documents, comments and its tracepoint
mm/damon: add a tracepoint for damos apply target regions
mm/damon: provide pseudo-moving sum based access rate
mm/damon: implement DAMOS apply intervals
mm/damon/core-test: Fix memory leaks in core-test
mm/damon/sysfs-schemes: Do DAMOS tried regions update for only one apply interval
- In the series "Do not try to access unaccepted memory" Adrian Hunter
provides some fixups for the recently-added "unaccepted memory' feature.
To increase the feature's checking coverage. "Plug a few gaps where
RAM is exposed without checking if it is unaccepted memory".
- In the series "cleanups for lockless slab shrink" Qi Zheng has done
some maintenance work which is preparation for the lockless slab
shrinking code.
- Qi Zheng has redone the earlier (and reverted) attempt to make slab
shrinking lockless in the series "use refcount+RCU method to implement
lockless slab shrink".
- David Hildenbrand contributes some maintenance work for the rmap code
in the series "Anon rmap cleanups".
- Kefeng Wang does more folio conversions and some maintenance work in
the migration code. Series "mm: migrate: more folio conversion and
unification".
- Matthew Wilcox has fixed an issue in the buffer_head code which was
causing long stalls under some heavy memory/IO loads. Some cleanups
were added on the way. Series "Add and use bdev_getblk()".
- In the series "Use nth_page() in place of direct struct page
manipulation" Zi Yan has fixed a potential issue with the direct
manipulation of hugetlb page frames.
- In the series "mm: hugetlb: Skip initialization of gigantic tail
struct pages if freed by HVO" has improved our handling of gigantic
pages in the hugetlb vmmemmep optimizaton code. This provides
significant boot time improvements when significant amounts of gigantic
pages are in use.
- Matthew Wilcox has sent the series "Small hugetlb cleanups" - code
rationalization and folio conversions in the hugetlb code.
- Yin Fengwei has improved mlock()'s handling of large folios in the
series "support large folio for mlock"
- In the series "Expose swapcache stat for memcg v1" Liu Shixin has
added statistics for memcg v1 users which are available (and useful)
under memcg v2.
- Florent Revest has enhanced the MDWE (Memory-Deny-Write-Executable)
prctl so that userspace may direct the kernel to not automatically
propagate the denial to child processes. The series is named "MDWE
without inheritance".
- Kefeng Wang has provided the series "mm: convert numa balancing
functions to use a folio" which does what it says.
- In the series "mm/ksm: add fork-exec support for prctl" Stefan Roesch
makes is possible for a process to propagate KSM treatment across
exec().
- Huang Ying has enhanced memory tiering's calculation of memory
distances. This is used to permit the dax/kmem driver to use "high
bandwidth memory" in addition to Optane Data Center Persistent Memory
Modules (DCPMM). The series is named "memory tiering: calculate
abstract distance based on ACPI HMAT"
- In the series "Smart scanning mode for KSM" Stefan Roesch has
optimized KSM by teaching it to retain and use some historical
information from previous scans.
- Yosry Ahmed has fixed some inconsistencies in memcg statistics in the
series "mm: memcg: fix tracking of pending stats updates values".
- In the series "Implement IOCTL to get and optionally clear info about
PTEs" Peter Xu has added an ioctl to /proc/<pid>/pagemap which permits
us to atomically read-then-clear page softdirty state. This is mainly
used by CRIU.
- Hugh Dickins contributed the series "shmem,tmpfs: general maintenance"
- a bunch of relatively minor maintenance tweaks to this code.
- Matthew Wilcox has increased the use of the VMA lock over file-backed
page faults in the series "Handle more faults under the VMA lock". Some
rationalizations of the fault path became possible as a result.
- In the series "mm/rmap: convert page_move_anon_rmap() to
folio_move_anon_rmap()" David Hildenbrand has implemented some cleanups
and folio conversions.
- In the series "various improvements to the GUP interface" Lorenzo
Stoakes has simplified and improved the GUP interface with an eye to
providing groundwork for future improvements.
- Andrey Konovalov has sent along the series "kasan: assorted fixes and
improvements" which does those things.
- Some page allocator maintenance work from Kemeng Shi in the series
"Two minor cleanups to break_down_buddy_pages".
- In thes series "New selftest for mm" Breno Leitao has developed
another MM self test which tickles a race we had between madvise() and
page faults.
- In the series "Add folio_end_read" Matthew Wilcox provides cleanups
and an optimization to the core pagecache code.
- Nhat Pham has added memcg accounting for hugetlb memory in the series
"hugetlb memcg accounting".
- Cleanups and rationalizations to the pagemap code from Lorenzo
Stoakes, in the series "Abstract vma_merge() and split_vma()".
- Audra Mitchell has fixed issues in the procfs page_owner code's new
timestamping feature which was causing some misbehaviours. In the
series "Fix page_owner's use of free timestamps".
- Lorenzo Stoakes has fixed the handling of new mappings of sealed files
in the series "permit write-sealed memfd read-only shared mappings".
- Mike Kravetz has optimized the hugetlb vmemmap optimization in the
series "Batch hugetlb vmemmap modification operations".
- Some buffer_head folio conversions and cleanups from Matthew Wilcox in
the series "Finish the create_empty_buffers() transition".
- As a page allocator performance optimization Huang Ying has added
automatic tuning to the allocator's per-cpu-pages feature, in the series
"mm: PCP high auto-tuning".
- Roman Gushchin has contributed the patchset "mm: improve performance
of accounted kernel memory allocations" which improves their performance
by ~30% as measured by a micro-benchmark.
- folio conversions from Kefeng Wang in the series "mm: convert page
cpupid functions to folios".
- Some kmemleak fixups in Liu Shixin's series "Some bugfix about
kmemleak".
- Qi Zheng has improved our handling of memoryless nodes by keeping them
off the allocation fallback list. This is done in the series "handle
memoryless nodes more appropriately".
- khugepaged conversions from Vishal Moola in the series "Some
khugepaged folio conversions".
-----BEGIN PGP SIGNATURE-----
iHUEABYIAB0WIQTTMBEPP41GrTpTJgfdBJ7gKXxAjgUCZULEMwAKCRDdBJ7gKXxA
jhQHAQCYpD3g849x69DmHnHWHm/EHQLvQmRMDeYZI+nx/sCJOwEAw4AKg0Oemv9y
FgeUPAD1oasg6CP+INZvCj34waNxwAc=
=E+Y4
-----END PGP SIGNATURE-----
Merge tag 'mm-stable-2023-11-01-14-33' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Pull MM updates from Andrew Morton:
"Many singleton patches against the MM code. The patch series which are
included in this merge do the following:
- Kemeng Shi has contributed some compation maintenance work in the
series 'Fixes and cleanups to compaction'
- Joel Fernandes has a patchset ('Optimize mremap during mutual
alignment within PMD') which fixes an obscure issue with mremap()'s
pagetable handling during a subsequent exec(), based upon an
implementation which Linus suggested
- More DAMON/DAMOS maintenance and feature work from SeongJae Park i
the following patch series:
mm/damon: misc fixups for documents, comments and its tracepoint
mm/damon: add a tracepoint for damos apply target regions
mm/damon: provide pseudo-moving sum based access rate
mm/damon: implement DAMOS apply intervals
mm/damon/core-test: Fix memory leaks in core-test
mm/damon/sysfs-schemes: Do DAMOS tried regions update for only one apply interval
- In the series 'Do not try to access unaccepted memory' Adrian
Hunter provides some fixups for the recently-added 'unaccepted
memory' feature. To increase the feature's checking coverage. 'Plug
a few gaps where RAM is exposed without checking if it is
unaccepted memory'
- In the series 'cleanups for lockless slab shrink' Qi Zheng has done
some maintenance work which is preparation for the lockless slab
shrinking code
- Qi Zheng has redone the earlier (and reverted) attempt to make slab
shrinking lockless in the series 'use refcount+RCU method to
implement lockless slab shrink'
- David Hildenbrand contributes some maintenance work for the rmap
code in the series 'Anon rmap cleanups'
- Kefeng Wang does more folio conversions and some maintenance work
in the migration code. Series 'mm: migrate: more folio conversion
and unification'
- Matthew Wilcox has fixed an issue in the buffer_head code which was
causing long stalls under some heavy memory/IO loads. Some cleanups
were added on the way. Series 'Add and use bdev_getblk()'
- In the series 'Use nth_page() in place of direct struct page
manipulation' Zi Yan has fixed a potential issue with the direct
manipulation of hugetlb page frames
- In the series 'mm: hugetlb: Skip initialization of gigantic tail
struct pages if freed by HVO' has improved our handling of gigantic
pages in the hugetlb vmmemmep optimizaton code. This provides
significant boot time improvements when significant amounts of
gigantic pages are in use
- Matthew Wilcox has sent the series 'Small hugetlb cleanups' - code
rationalization and folio conversions in the hugetlb code
- Yin Fengwei has improved mlock()'s handling of large folios in the
series 'support large folio for mlock'
- In the series 'Expose swapcache stat for memcg v1' Liu Shixin has
added statistics for memcg v1 users which are available (and
useful) under memcg v2
- Florent Revest has enhanced the MDWE (Memory-Deny-Write-Executable)
prctl so that userspace may direct the kernel to not automatically
propagate the denial to child processes. The series is named 'MDWE
without inheritance'
- Kefeng Wang has provided the series 'mm: convert numa balancing
functions to use a folio' which does what it says
- In the series 'mm/ksm: add fork-exec support for prctl' Stefan
Roesch makes is possible for a process to propagate KSM treatment
across exec()
- Huang Ying has enhanced memory tiering's calculation of memory
distances. This is used to permit the dax/kmem driver to use 'high
bandwidth memory' in addition to Optane Data Center Persistent
Memory Modules (DCPMM). The series is named 'memory tiering:
calculate abstract distance based on ACPI HMAT'
- In the series 'Smart scanning mode for KSM' Stefan Roesch has
optimized KSM by teaching it to retain and use some historical
information from previous scans
- Yosry Ahmed has fixed some inconsistencies in memcg statistics in
the series 'mm: memcg: fix tracking of pending stats updates
values'
- In the series 'Implement IOCTL to get and optionally clear info
about PTEs' Peter Xu has added an ioctl to /proc/<pid>/pagemap
which permits us to atomically read-then-clear page softdirty
state. This is mainly used by CRIU
- Hugh Dickins contributed the series 'shmem,tmpfs: general
maintenance', a bunch of relatively minor maintenance tweaks to
this code
- Matthew Wilcox has increased the use of the VMA lock over
file-backed page faults in the series 'Handle more faults under the
VMA lock'. Some rationalizations of the fault path became possible
as a result
- In the series 'mm/rmap: convert page_move_anon_rmap() to
folio_move_anon_rmap()' David Hildenbrand has implemented some
cleanups and folio conversions
- In the series 'various improvements to the GUP interface' Lorenzo
Stoakes has simplified and improved the GUP interface with an eye
to providing groundwork for future improvements
- Andrey Konovalov has sent along the series 'kasan: assorted fixes
and improvements' which does those things
- Some page allocator maintenance work from Kemeng Shi in the series
'Two minor cleanups to break_down_buddy_pages'
- In thes series 'New selftest for mm' Breno Leitao has developed
another MM self test which tickles a race we had between madvise()
and page faults
- In the series 'Add folio_end_read' Matthew Wilcox provides cleanups
and an optimization to the core pagecache code
- Nhat Pham has added memcg accounting for hugetlb memory in the
series 'hugetlb memcg accounting'
- Cleanups and rationalizations to the pagemap code from Lorenzo
Stoakes, in the series 'Abstract vma_merge() and split_vma()'
- Audra Mitchell has fixed issues in the procfs page_owner code's new
timestamping feature which was causing some misbehaviours. In the
series 'Fix page_owner's use of free timestamps'
- Lorenzo Stoakes has fixed the handling of new mappings of sealed
files in the series 'permit write-sealed memfd read-only shared
mappings'
- Mike Kravetz has optimized the hugetlb vmemmap optimization in the
series 'Batch hugetlb vmemmap modification operations'
- Some buffer_head folio conversions and cleanups from Matthew Wilcox
in the series 'Finish the create_empty_buffers() transition'
- As a page allocator performance optimization Huang Ying has added
automatic tuning to the allocator's per-cpu-pages feature, in the
series 'mm: PCP high auto-tuning'
- Roman Gushchin has contributed the patchset 'mm: improve
performance of accounted kernel memory allocations' which improves
their performance by ~30% as measured by a micro-benchmark
- folio conversions from Kefeng Wang in the series 'mm: convert page
cpupid functions to folios'
- Some kmemleak fixups in Liu Shixin's series 'Some bugfix about
kmemleak'
- Qi Zheng has improved our handling of memoryless nodes by keeping
them off the allocation fallback list. This is done in the series
'handle memoryless nodes more appropriately'
- khugepaged conversions from Vishal Moola in the series 'Some
khugepaged folio conversions'"
[ bcachefs conflicts with the dynamically allocated shrinkers have been
resolved as per Stephen Rothwell in
https://lore.kernel.org/all/20230913093553.4290421e@canb.auug.org.au/
with help from Qi Zheng.
The clone3 test filtering conflict was half-arsed by yours truly ]
* tag 'mm-stable-2023-11-01-14-33' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm: (406 commits)
mm/damon/sysfs: update monitoring target regions for online input commit
mm/damon/sysfs: remove requested targets when online-commit inputs
selftests: add a sanity check for zswap
Documentation: maple_tree: fix word spelling error
mm/vmalloc: fix the unchecked dereference warning in vread_iter()
zswap: export compression failure stats
Documentation: ubsan: drop "the" from article title
mempolicy: migration attempt to match interleave nodes
mempolicy: mmap_lock is not needed while migrating folios
mempolicy: alloc_pages_mpol() for NUMA policy without vma
mm: add page_rmappable_folio() wrapper
mempolicy: remove confusing MPOL_MF_LAZY dead code
mempolicy: mpol_shared_policy_init() without pseudo-vma
mempolicy trivia: use pgoff_t in shared mempolicy tree
mempolicy trivia: slightly more consistent naming
mempolicy trivia: delete those ancient pr_debug()s
mempolicy: fix migrate_pages(2) syscall return nr_failed
kernfs: drop shared NUMA mempolicy hooks
hugetlbfs: drop shared NUMA mempolicy pretence
mm/damon/sysfs-test: add a unit test for damon_sysfs_set_targets()
...
2023-11-02 22:38:47 -07:00
|
|
|
shrinker_free(bc->shrink);
|
2020-11-12 15:19:47 -07:00
|
|
|
|
2022-10-14 21:47:21 -07:00
|
|
|
/*
|
|
|
|
* The loop is needed to guard against racing with rehash:
|
|
|
|
*/
|
|
|
|
while (atomic_long_read(&bc->nr_keys)) {
|
|
|
|
rcu_read_lock();
|
|
|
|
tbl = rht_dereference_rcu(bc->table.tbl, &bc->table);
|
2024-08-19 13:41:00 -07:00
|
|
|
if (tbl) {
|
|
|
|
if (tbl->nest) {
|
|
|
|
/* wait for in progress rehash */
|
|
|
|
rcu_read_unlock();
|
|
|
|
mutex_lock(&bc->table.mutex);
|
|
|
|
mutex_unlock(&bc->table.mutex);
|
|
|
|
rcu_read_lock();
|
|
|
|
continue;
|
|
|
|
}
|
2022-10-14 21:47:21 -07:00
|
|
|
for (i = 0; i < tbl->size; i++)
|
2024-08-19 13:41:00 -07:00
|
|
|
while (pos = rht_ptr_rcu(&tbl->buckets[i]), !rht_is_a_nulls(pos)) {
|
|
|
|
ck = container_of(pos, struct bkey_cached, hash);
|
2024-06-08 19:32:40 -07:00
|
|
|
BUG_ON(!bkey_cached_evict(bc, ck));
|
|
|
|
kfree(ck->k);
|
|
|
|
kmem_cache_free(bch2_key_cache, ck);
|
2022-10-14 21:47:21 -07:00
|
|
|
}
|
2024-08-19 13:41:00 -07:00
|
|
|
}
|
2022-10-14 21:47:21 -07:00
|
|
|
rcu_read_unlock();
|
|
|
|
}
|
2021-03-24 20:37:33 -07:00
|
|
|
|
2022-10-14 21:47:21 -07:00
|
|
|
if (atomic_long_read(&bc->nr_dirty) &&
|
|
|
|
!bch2_journal_error(&c->journal) &&
|
2023-11-26 15:05:02 -07:00
|
|
|
test_bit(BCH_FS_was_rw, &c->flags))
|
2022-10-14 21:47:21 -07:00
|
|
|
panic("btree key cache shutdown error: nr_dirty nonzero (%li)\n",
|
|
|
|
atomic_long_read(&bc->nr_dirty));
|
|
|
|
|
|
|
|
if (atomic_long_read(&bc->nr_keys))
|
|
|
|
panic("btree key cache shutdown error: nr_keys nonzero (%li)\n",
|
|
|
|
atomic_long_read(&bc->nr_keys));
|
2020-12-13 14:12:04 -07:00
|
|
|
|
2020-11-29 21:48:20 -07:00
|
|
|
if (bc->table_init_done)
|
|
|
|
rhashtable_destroy(&bc->table);
|
2024-06-13 12:35:47 -07:00
|
|
|
|
|
|
|
rcu_pending_exit(&bc->pending[0]);
|
|
|
|
rcu_pending_exit(&bc->pending[1]);
|
|
|
|
|
|
|
|
free_percpu(bc->nr_pending);
|
2019-03-07 17:46:10 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void bch2_fs_btree_key_cache_init_early(struct btree_key_cache *c)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2020-11-12 15:19:47 -07:00
|
|
|
int bch2_fs_btree_key_cache_init(struct btree_key_cache *bc)
|
2019-03-07 17:46:10 -07:00
|
|
|
{
|
2020-11-12 15:19:47 -07:00
|
|
|
struct bch_fs *c = container_of(bc, struct bch_fs, btree_key_cache);
|
Many singleton patches against the MM code. The patch series which are
included in this merge do the following:
- Kemeng Shi has contributed some compation maintenance work in the
series "Fixes and cleanups to compaction".
- Joel Fernandes has a patchset ("Optimize mremap during mutual
alignment within PMD") which fixes an obscure issue with mremap()'s
pagetable handling during a subsequent exec(), based upon an
implementation which Linus suggested.
- More DAMON/DAMOS maintenance and feature work from SeongJae Park i the
following patch series:
mm/damon: misc fixups for documents, comments and its tracepoint
mm/damon: add a tracepoint for damos apply target regions
mm/damon: provide pseudo-moving sum based access rate
mm/damon: implement DAMOS apply intervals
mm/damon/core-test: Fix memory leaks in core-test
mm/damon/sysfs-schemes: Do DAMOS tried regions update for only one apply interval
- In the series "Do not try to access unaccepted memory" Adrian Hunter
provides some fixups for the recently-added "unaccepted memory' feature.
To increase the feature's checking coverage. "Plug a few gaps where
RAM is exposed without checking if it is unaccepted memory".
- In the series "cleanups for lockless slab shrink" Qi Zheng has done
some maintenance work which is preparation for the lockless slab
shrinking code.
- Qi Zheng has redone the earlier (and reverted) attempt to make slab
shrinking lockless in the series "use refcount+RCU method to implement
lockless slab shrink".
- David Hildenbrand contributes some maintenance work for the rmap code
in the series "Anon rmap cleanups".
- Kefeng Wang does more folio conversions and some maintenance work in
the migration code. Series "mm: migrate: more folio conversion and
unification".
- Matthew Wilcox has fixed an issue in the buffer_head code which was
causing long stalls under some heavy memory/IO loads. Some cleanups
were added on the way. Series "Add and use bdev_getblk()".
- In the series "Use nth_page() in place of direct struct page
manipulation" Zi Yan has fixed a potential issue with the direct
manipulation of hugetlb page frames.
- In the series "mm: hugetlb: Skip initialization of gigantic tail
struct pages if freed by HVO" has improved our handling of gigantic
pages in the hugetlb vmmemmep optimizaton code. This provides
significant boot time improvements when significant amounts of gigantic
pages are in use.
- Matthew Wilcox has sent the series "Small hugetlb cleanups" - code
rationalization and folio conversions in the hugetlb code.
- Yin Fengwei has improved mlock()'s handling of large folios in the
series "support large folio for mlock"
- In the series "Expose swapcache stat for memcg v1" Liu Shixin has
added statistics for memcg v1 users which are available (and useful)
under memcg v2.
- Florent Revest has enhanced the MDWE (Memory-Deny-Write-Executable)
prctl so that userspace may direct the kernel to not automatically
propagate the denial to child processes. The series is named "MDWE
without inheritance".
- Kefeng Wang has provided the series "mm: convert numa balancing
functions to use a folio" which does what it says.
- In the series "mm/ksm: add fork-exec support for prctl" Stefan Roesch
makes is possible for a process to propagate KSM treatment across
exec().
- Huang Ying has enhanced memory tiering's calculation of memory
distances. This is used to permit the dax/kmem driver to use "high
bandwidth memory" in addition to Optane Data Center Persistent Memory
Modules (DCPMM). The series is named "memory tiering: calculate
abstract distance based on ACPI HMAT"
- In the series "Smart scanning mode for KSM" Stefan Roesch has
optimized KSM by teaching it to retain and use some historical
information from previous scans.
- Yosry Ahmed has fixed some inconsistencies in memcg statistics in the
series "mm: memcg: fix tracking of pending stats updates values".
- In the series "Implement IOCTL to get and optionally clear info about
PTEs" Peter Xu has added an ioctl to /proc/<pid>/pagemap which permits
us to atomically read-then-clear page softdirty state. This is mainly
used by CRIU.
- Hugh Dickins contributed the series "shmem,tmpfs: general maintenance"
- a bunch of relatively minor maintenance tweaks to this code.
- Matthew Wilcox has increased the use of the VMA lock over file-backed
page faults in the series "Handle more faults under the VMA lock". Some
rationalizations of the fault path became possible as a result.
- In the series "mm/rmap: convert page_move_anon_rmap() to
folio_move_anon_rmap()" David Hildenbrand has implemented some cleanups
and folio conversions.
- In the series "various improvements to the GUP interface" Lorenzo
Stoakes has simplified and improved the GUP interface with an eye to
providing groundwork for future improvements.
- Andrey Konovalov has sent along the series "kasan: assorted fixes and
improvements" which does those things.
- Some page allocator maintenance work from Kemeng Shi in the series
"Two minor cleanups to break_down_buddy_pages".
- In thes series "New selftest for mm" Breno Leitao has developed
another MM self test which tickles a race we had between madvise() and
page faults.
- In the series "Add folio_end_read" Matthew Wilcox provides cleanups
and an optimization to the core pagecache code.
- Nhat Pham has added memcg accounting for hugetlb memory in the series
"hugetlb memcg accounting".
- Cleanups and rationalizations to the pagemap code from Lorenzo
Stoakes, in the series "Abstract vma_merge() and split_vma()".
- Audra Mitchell has fixed issues in the procfs page_owner code's new
timestamping feature which was causing some misbehaviours. In the
series "Fix page_owner's use of free timestamps".
- Lorenzo Stoakes has fixed the handling of new mappings of sealed files
in the series "permit write-sealed memfd read-only shared mappings".
- Mike Kravetz has optimized the hugetlb vmemmap optimization in the
series "Batch hugetlb vmemmap modification operations".
- Some buffer_head folio conversions and cleanups from Matthew Wilcox in
the series "Finish the create_empty_buffers() transition".
- As a page allocator performance optimization Huang Ying has added
automatic tuning to the allocator's per-cpu-pages feature, in the series
"mm: PCP high auto-tuning".
- Roman Gushchin has contributed the patchset "mm: improve performance
of accounted kernel memory allocations" which improves their performance
by ~30% as measured by a micro-benchmark.
- folio conversions from Kefeng Wang in the series "mm: convert page
cpupid functions to folios".
- Some kmemleak fixups in Liu Shixin's series "Some bugfix about
kmemleak".
- Qi Zheng has improved our handling of memoryless nodes by keeping them
off the allocation fallback list. This is done in the series "handle
memoryless nodes more appropriately".
- khugepaged conversions from Vishal Moola in the series "Some
khugepaged folio conversions".
-----BEGIN PGP SIGNATURE-----
iHUEABYIAB0WIQTTMBEPP41GrTpTJgfdBJ7gKXxAjgUCZULEMwAKCRDdBJ7gKXxA
jhQHAQCYpD3g849x69DmHnHWHm/EHQLvQmRMDeYZI+nx/sCJOwEAw4AKg0Oemv9y
FgeUPAD1oasg6CP+INZvCj34waNxwAc=
=E+Y4
-----END PGP SIGNATURE-----
Merge tag 'mm-stable-2023-11-01-14-33' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Pull MM updates from Andrew Morton:
"Many singleton patches against the MM code. The patch series which are
included in this merge do the following:
- Kemeng Shi has contributed some compation maintenance work in the
series 'Fixes and cleanups to compaction'
- Joel Fernandes has a patchset ('Optimize mremap during mutual
alignment within PMD') which fixes an obscure issue with mremap()'s
pagetable handling during a subsequent exec(), based upon an
implementation which Linus suggested
- More DAMON/DAMOS maintenance and feature work from SeongJae Park i
the following patch series:
mm/damon: misc fixups for documents, comments and its tracepoint
mm/damon: add a tracepoint for damos apply target regions
mm/damon: provide pseudo-moving sum based access rate
mm/damon: implement DAMOS apply intervals
mm/damon/core-test: Fix memory leaks in core-test
mm/damon/sysfs-schemes: Do DAMOS tried regions update for only one apply interval
- In the series 'Do not try to access unaccepted memory' Adrian
Hunter provides some fixups for the recently-added 'unaccepted
memory' feature. To increase the feature's checking coverage. 'Plug
a few gaps where RAM is exposed without checking if it is
unaccepted memory'
- In the series 'cleanups for lockless slab shrink' Qi Zheng has done
some maintenance work which is preparation for the lockless slab
shrinking code
- Qi Zheng has redone the earlier (and reverted) attempt to make slab
shrinking lockless in the series 'use refcount+RCU method to
implement lockless slab shrink'
- David Hildenbrand contributes some maintenance work for the rmap
code in the series 'Anon rmap cleanups'
- Kefeng Wang does more folio conversions and some maintenance work
in the migration code. Series 'mm: migrate: more folio conversion
and unification'
- Matthew Wilcox has fixed an issue in the buffer_head code which was
causing long stalls under some heavy memory/IO loads. Some cleanups
were added on the way. Series 'Add and use bdev_getblk()'
- In the series 'Use nth_page() in place of direct struct page
manipulation' Zi Yan has fixed a potential issue with the direct
manipulation of hugetlb page frames
- In the series 'mm: hugetlb: Skip initialization of gigantic tail
struct pages if freed by HVO' has improved our handling of gigantic
pages in the hugetlb vmmemmep optimizaton code. This provides
significant boot time improvements when significant amounts of
gigantic pages are in use
- Matthew Wilcox has sent the series 'Small hugetlb cleanups' - code
rationalization and folio conversions in the hugetlb code
- Yin Fengwei has improved mlock()'s handling of large folios in the
series 'support large folio for mlock'
- In the series 'Expose swapcache stat for memcg v1' Liu Shixin has
added statistics for memcg v1 users which are available (and
useful) under memcg v2
- Florent Revest has enhanced the MDWE (Memory-Deny-Write-Executable)
prctl so that userspace may direct the kernel to not automatically
propagate the denial to child processes. The series is named 'MDWE
without inheritance'
- Kefeng Wang has provided the series 'mm: convert numa balancing
functions to use a folio' which does what it says
- In the series 'mm/ksm: add fork-exec support for prctl' Stefan
Roesch makes is possible for a process to propagate KSM treatment
across exec()
- Huang Ying has enhanced memory tiering's calculation of memory
distances. This is used to permit the dax/kmem driver to use 'high
bandwidth memory' in addition to Optane Data Center Persistent
Memory Modules (DCPMM). The series is named 'memory tiering:
calculate abstract distance based on ACPI HMAT'
- In the series 'Smart scanning mode for KSM' Stefan Roesch has
optimized KSM by teaching it to retain and use some historical
information from previous scans
- Yosry Ahmed has fixed some inconsistencies in memcg statistics in
the series 'mm: memcg: fix tracking of pending stats updates
values'
- In the series 'Implement IOCTL to get and optionally clear info
about PTEs' Peter Xu has added an ioctl to /proc/<pid>/pagemap
which permits us to atomically read-then-clear page softdirty
state. This is mainly used by CRIU
- Hugh Dickins contributed the series 'shmem,tmpfs: general
maintenance', a bunch of relatively minor maintenance tweaks to
this code
- Matthew Wilcox has increased the use of the VMA lock over
file-backed page faults in the series 'Handle more faults under the
VMA lock'. Some rationalizations of the fault path became possible
as a result
- In the series 'mm/rmap: convert page_move_anon_rmap() to
folio_move_anon_rmap()' David Hildenbrand has implemented some
cleanups and folio conversions
- In the series 'various improvements to the GUP interface' Lorenzo
Stoakes has simplified and improved the GUP interface with an eye
to providing groundwork for future improvements
- Andrey Konovalov has sent along the series 'kasan: assorted fixes
and improvements' which does those things
- Some page allocator maintenance work from Kemeng Shi in the series
'Two minor cleanups to break_down_buddy_pages'
- In thes series 'New selftest for mm' Breno Leitao has developed
another MM self test which tickles a race we had between madvise()
and page faults
- In the series 'Add folio_end_read' Matthew Wilcox provides cleanups
and an optimization to the core pagecache code
- Nhat Pham has added memcg accounting for hugetlb memory in the
series 'hugetlb memcg accounting'
- Cleanups and rationalizations to the pagemap code from Lorenzo
Stoakes, in the series 'Abstract vma_merge() and split_vma()'
- Audra Mitchell has fixed issues in the procfs page_owner code's new
timestamping feature which was causing some misbehaviours. In the
series 'Fix page_owner's use of free timestamps'
- Lorenzo Stoakes has fixed the handling of new mappings of sealed
files in the series 'permit write-sealed memfd read-only shared
mappings'
- Mike Kravetz has optimized the hugetlb vmemmap optimization in the
series 'Batch hugetlb vmemmap modification operations'
- Some buffer_head folio conversions and cleanups from Matthew Wilcox
in the series 'Finish the create_empty_buffers() transition'
- As a page allocator performance optimization Huang Ying has added
automatic tuning to the allocator's per-cpu-pages feature, in the
series 'mm: PCP high auto-tuning'
- Roman Gushchin has contributed the patchset 'mm: improve
performance of accounted kernel memory allocations' which improves
their performance by ~30% as measured by a micro-benchmark
- folio conversions from Kefeng Wang in the series 'mm: convert page
cpupid functions to folios'
- Some kmemleak fixups in Liu Shixin's series 'Some bugfix about
kmemleak'
- Qi Zheng has improved our handling of memoryless nodes by keeping
them off the allocation fallback list. This is done in the series
'handle memoryless nodes more appropriately'
- khugepaged conversions from Vishal Moola in the series 'Some
khugepaged folio conversions'"
[ bcachefs conflicts with the dynamically allocated shrinkers have been
resolved as per Stephen Rothwell in
https://lore.kernel.org/all/20230913093553.4290421e@canb.auug.org.au/
with help from Qi Zheng.
The clone3 test filtering conflict was half-arsed by yours truly ]
* tag 'mm-stable-2023-11-01-14-33' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm: (406 commits)
mm/damon/sysfs: update monitoring target regions for online input commit
mm/damon/sysfs: remove requested targets when online-commit inputs
selftests: add a sanity check for zswap
Documentation: maple_tree: fix word spelling error
mm/vmalloc: fix the unchecked dereference warning in vread_iter()
zswap: export compression failure stats
Documentation: ubsan: drop "the" from article title
mempolicy: migration attempt to match interleave nodes
mempolicy: mmap_lock is not needed while migrating folios
mempolicy: alloc_pages_mpol() for NUMA policy without vma
mm: add page_rmappable_folio() wrapper
mempolicy: remove confusing MPOL_MF_LAZY dead code
mempolicy: mpol_shared_policy_init() without pseudo-vma
mempolicy trivia: use pgoff_t in shared mempolicy tree
mempolicy trivia: slightly more consistent naming
mempolicy trivia: delete those ancient pr_debug()s
mempolicy: fix migrate_pages(2) syscall return nr_failed
kernfs: drop shared NUMA mempolicy hooks
hugetlbfs: drop shared NUMA mempolicy pretence
mm/damon/sysfs-test: add a unit test for damon_sysfs_set_targets()
...
2023-11-02 22:38:47 -07:00
|
|
|
struct shrinker *shrink;
|
2020-11-12 15:19:47 -07:00
|
|
|
|
2024-06-13 12:35:47 -07:00
|
|
|
bc->nr_pending = alloc_percpu(size_t);
|
|
|
|
if (!bc->nr_pending)
|
|
|
|
return -BCH_ERR_ENOMEM_fs_btree_cache_init;
|
|
|
|
|
|
|
|
if (rcu_pending_init(&bc->pending[0], &c->btree_trans_barrier, __bkey_cached_free) ||
|
|
|
|
rcu_pending_init(&bc->pending[1], &c->btree_trans_barrier, __bkey_cached_free))
|
|
|
|
return -BCH_ERR_ENOMEM_fs_btree_cache_init;
|
|
|
|
|
2023-03-14 12:35:57 -07:00
|
|
|
if (rhashtable_init(&bc->table, &bch2_btree_key_cache_params))
|
|
|
|
return -BCH_ERR_ENOMEM_fs_btree_cache_init;
|
2020-11-29 21:48:20 -07:00
|
|
|
|
|
|
|
bc->table_init_done = true;
|
2021-04-04 22:23:55 -07:00
|
|
|
|
Second bcachefs pull request for 6.7-rc1
Here's the second big bcachefs pull request. This brings your tree up to
date with my master branch, which is what existing bcachefs users are
currently running.
All but the last few patches have been in linux-next, those being small
fixes. Test results from my dashboard:
https://evilpiepirate.org/~testdashboard/ci?commit=c7046ed0cf9bb33599aa7e72e7b67bba4be42d64
New features:
- rebalance_work btree (and metadata version 1.3): the rebalance thread
no longer has to scan to find extents that need processing - big
scalability improvement.
- sb_errors superblock section: this adds counters for each fsck error
type, since filesystem creation, along with the date of the most
recent error. It'll get us better bug reports (since users do not
typically report errors that fsck was able to fix), and I might add
telemetry for this in the future.
Fixes include:
- multiple snapshot deletion fixes
- members_v2 fixups
- deleted_inodes btree fixes
- copygc thread no longer spins when a device is full but has no
fragmented buckets (i.e. rebalance needs to move data around instead)
- a fix for a memory reclaim issue with the btree key cache: we're now
careful not to hold the srcu read lock that blocks key cache reclaim
for too long
- an early allocator locking fix, from Brian
- endianness fixes, from Brian
- CONFIG_BCACHEFS_DEBUG_TRANSACTIONS no longer defaults to y, a big
performance improvement on multithreaded workloads
-----BEGIN PGP SIGNATURE-----
iQIzBAABCgAdFiEEKnAFLkS8Qha+jvQrE6szbY3KbnYFAmVH9xYACgkQE6szbY3K
bnahLRAAiNRZL73SQ+MW79o4yPqGwt0Eyy/mvoiGpZf1B8uXp0oZ55j2w3l887Uf
LeM03mInAYCPdyp/d4vxqIr96j9BODmRRl8sEkkGdJDzokLG+22F0ovOe45KWTxL
kBoNdng/O/oeOe/1K7taP3KzBvMx2nOF6oA+xfgyCjECMArAIXek0iocyEUR4Ywd
vGKhLNn1k2c+94wacnDYwjjdcLBxoqxsFXlpu6V0BcaY+DX4J3aBaGmj75KEoCI0
VbBOzxrOO4QzJrzW2+hxZZWgGyvReCkBJvqfORfuPxiSbFobTim10MdfZOAMQA1U
Xr1FTEpK1wMX0/pPVgZRqaOsttC+yc/SsfPNgSxybgHPbDlMLaakDHjvYssbKOYG
urDWSMG5yCsktSLj95SXsvUFKZaZFD72SKBNdgdt/nZjwTHuNQ7IkdrMwIrCQ/PT
Ifn50UrR/Ahd8RAd5tyNCPw6U9VfwnxACSNl2KA7ONKpvHb+gSt1JsJTDyz1+gN9
nFVrw1SHKQ6EIV6XhVon/5DEuRTzqoYGWoN08FHEUq9fBlvnVpmbJErCQMplOjz9
OQnAfpJH4YqkpXyjFAjP1V0An+RUn8QvDgXNqC9TyvCYuOliVFuil4y7/c+7oIQU
NEoz+jVLenqsGOGAbduI4/Q567COojRgwEvbebSIxSImXuhCNj4=
=Lo4N
-----END PGP SIGNATURE-----
Merge tag 'bcachefs-2023-11-5' of https://evilpiepirate.org/git/bcachefs
Pull more bcachefs updates from Kent Overstreet:
"Here's the second big bcachefs pull request. This brings your tree up
to date with my master branch, which is what existing bcachefs users
are currently running.
New features:
- rebalance_work btree (and metadata version 1.3): the rebalance
thread no longer has to scan to find extents that need processing -
big scalability improvement.
- sb_errors superblock section: this adds counters for each fsck
error type, since filesystem creation, along with the date of the
most recent error. It'll get us better bug reports (since users do
not typically report errors that fsck was able to fix), and I might
add telemetry for this in the future.
Fixes include:
- multiple snapshot deletion fixes
- members_v2 fixups
- deleted_inodes btree fixes
- copygc thread no longer spins when a device is full but has no
fragmented buckets (i.e. rebalance needs to move data around
instead)
- a fix for a memory reclaim issue with the btree key cache: we're
now careful not to hold the srcu read lock that blocks key cache
reclaim for too long
- an early allocator locking fix, from Brian
- endianness fixes, from Brian
- CONFIG_BCACHEFS_DEBUG_TRANSACTIONS no longer defaults to y, a big
performance improvement on multithreaded workloads"
* tag 'bcachefs-2023-11-5' of https://evilpiepirate.org/git/bcachefs: (70 commits)
bcachefs: Improve stripe checksum error message
bcachefs: Simplify, fix bch2_backpointer_get_key()
bcachefs: kill thing_it_points_to arg to backpointer_not_found()
bcachefs: bch2_ec_read_extent() now takes btree_trans
bcachefs: bch2_stripe_to_text() now prints ptr gens
bcachefs: Don't iterate over journal entries just for btree roots
bcachefs: Break up bch2_journal_write()
bcachefs: Replace ERANGE with private error codes
bcachefs: bkey_copy() is no longer a macro
bcachefs: x-macro-ify inode flags enum
bcachefs: Convert bch2_fs_open() to darray
bcachefs: Move __bch2_members_v2_get_mut to sb-members.h
bcachefs: bch2_prt_datetime()
bcachefs: CONFIG_BCACHEFS_DEBUG_TRANSACTIONS no longer defaults to y
bcachefs: Add a comment for BTREE_INSERT_NOJOURNAL usage
bcachefs: rebalance_work btree is not a snapshots btree
bcachefs: Add missing printk newlines
bcachefs: Fix recovery when forced to use JSET_NO_FLUSH journal entry
bcachefs: .get_parent() should return an error pointer
bcachefs: Fix bch2_delete_dead_inodes()
...
2023-11-07 12:38:38 -07:00
|
|
|
shrink = shrinker_alloc(0, "%s-btree_key_cache", c->name);
|
Many singleton patches against the MM code. The patch series which are
included in this merge do the following:
- Kemeng Shi has contributed some compation maintenance work in the
series "Fixes and cleanups to compaction".
- Joel Fernandes has a patchset ("Optimize mremap during mutual
alignment within PMD") which fixes an obscure issue with mremap()'s
pagetable handling during a subsequent exec(), based upon an
implementation which Linus suggested.
- More DAMON/DAMOS maintenance and feature work from SeongJae Park i the
following patch series:
mm/damon: misc fixups for documents, comments and its tracepoint
mm/damon: add a tracepoint for damos apply target regions
mm/damon: provide pseudo-moving sum based access rate
mm/damon: implement DAMOS apply intervals
mm/damon/core-test: Fix memory leaks in core-test
mm/damon/sysfs-schemes: Do DAMOS tried regions update for only one apply interval
- In the series "Do not try to access unaccepted memory" Adrian Hunter
provides some fixups for the recently-added "unaccepted memory' feature.
To increase the feature's checking coverage. "Plug a few gaps where
RAM is exposed without checking if it is unaccepted memory".
- In the series "cleanups for lockless slab shrink" Qi Zheng has done
some maintenance work which is preparation for the lockless slab
shrinking code.
- Qi Zheng has redone the earlier (and reverted) attempt to make slab
shrinking lockless in the series "use refcount+RCU method to implement
lockless slab shrink".
- David Hildenbrand contributes some maintenance work for the rmap code
in the series "Anon rmap cleanups".
- Kefeng Wang does more folio conversions and some maintenance work in
the migration code. Series "mm: migrate: more folio conversion and
unification".
- Matthew Wilcox has fixed an issue in the buffer_head code which was
causing long stalls under some heavy memory/IO loads. Some cleanups
were added on the way. Series "Add and use bdev_getblk()".
- In the series "Use nth_page() in place of direct struct page
manipulation" Zi Yan has fixed a potential issue with the direct
manipulation of hugetlb page frames.
- In the series "mm: hugetlb: Skip initialization of gigantic tail
struct pages if freed by HVO" has improved our handling of gigantic
pages in the hugetlb vmmemmep optimizaton code. This provides
significant boot time improvements when significant amounts of gigantic
pages are in use.
- Matthew Wilcox has sent the series "Small hugetlb cleanups" - code
rationalization and folio conversions in the hugetlb code.
- Yin Fengwei has improved mlock()'s handling of large folios in the
series "support large folio for mlock"
- In the series "Expose swapcache stat for memcg v1" Liu Shixin has
added statistics for memcg v1 users which are available (and useful)
under memcg v2.
- Florent Revest has enhanced the MDWE (Memory-Deny-Write-Executable)
prctl so that userspace may direct the kernel to not automatically
propagate the denial to child processes. The series is named "MDWE
without inheritance".
- Kefeng Wang has provided the series "mm: convert numa balancing
functions to use a folio" which does what it says.
- In the series "mm/ksm: add fork-exec support for prctl" Stefan Roesch
makes is possible for a process to propagate KSM treatment across
exec().
- Huang Ying has enhanced memory tiering's calculation of memory
distances. This is used to permit the dax/kmem driver to use "high
bandwidth memory" in addition to Optane Data Center Persistent Memory
Modules (DCPMM). The series is named "memory tiering: calculate
abstract distance based on ACPI HMAT"
- In the series "Smart scanning mode for KSM" Stefan Roesch has
optimized KSM by teaching it to retain and use some historical
information from previous scans.
- Yosry Ahmed has fixed some inconsistencies in memcg statistics in the
series "mm: memcg: fix tracking of pending stats updates values".
- In the series "Implement IOCTL to get and optionally clear info about
PTEs" Peter Xu has added an ioctl to /proc/<pid>/pagemap which permits
us to atomically read-then-clear page softdirty state. This is mainly
used by CRIU.
- Hugh Dickins contributed the series "shmem,tmpfs: general maintenance"
- a bunch of relatively minor maintenance tweaks to this code.
- Matthew Wilcox has increased the use of the VMA lock over file-backed
page faults in the series "Handle more faults under the VMA lock". Some
rationalizations of the fault path became possible as a result.
- In the series "mm/rmap: convert page_move_anon_rmap() to
folio_move_anon_rmap()" David Hildenbrand has implemented some cleanups
and folio conversions.
- In the series "various improvements to the GUP interface" Lorenzo
Stoakes has simplified and improved the GUP interface with an eye to
providing groundwork for future improvements.
- Andrey Konovalov has sent along the series "kasan: assorted fixes and
improvements" which does those things.
- Some page allocator maintenance work from Kemeng Shi in the series
"Two minor cleanups to break_down_buddy_pages".
- In thes series "New selftest for mm" Breno Leitao has developed
another MM self test which tickles a race we had between madvise() and
page faults.
- In the series "Add folio_end_read" Matthew Wilcox provides cleanups
and an optimization to the core pagecache code.
- Nhat Pham has added memcg accounting for hugetlb memory in the series
"hugetlb memcg accounting".
- Cleanups and rationalizations to the pagemap code from Lorenzo
Stoakes, in the series "Abstract vma_merge() and split_vma()".
- Audra Mitchell has fixed issues in the procfs page_owner code's new
timestamping feature which was causing some misbehaviours. In the
series "Fix page_owner's use of free timestamps".
- Lorenzo Stoakes has fixed the handling of new mappings of sealed files
in the series "permit write-sealed memfd read-only shared mappings".
- Mike Kravetz has optimized the hugetlb vmemmap optimization in the
series "Batch hugetlb vmemmap modification operations".
- Some buffer_head folio conversions and cleanups from Matthew Wilcox in
the series "Finish the create_empty_buffers() transition".
- As a page allocator performance optimization Huang Ying has added
automatic tuning to the allocator's per-cpu-pages feature, in the series
"mm: PCP high auto-tuning".
- Roman Gushchin has contributed the patchset "mm: improve performance
of accounted kernel memory allocations" which improves their performance
by ~30% as measured by a micro-benchmark.
- folio conversions from Kefeng Wang in the series "mm: convert page
cpupid functions to folios".
- Some kmemleak fixups in Liu Shixin's series "Some bugfix about
kmemleak".
- Qi Zheng has improved our handling of memoryless nodes by keeping them
off the allocation fallback list. This is done in the series "handle
memoryless nodes more appropriately".
- khugepaged conversions from Vishal Moola in the series "Some
khugepaged folio conversions".
-----BEGIN PGP SIGNATURE-----
iHUEABYIAB0WIQTTMBEPP41GrTpTJgfdBJ7gKXxAjgUCZULEMwAKCRDdBJ7gKXxA
jhQHAQCYpD3g849x69DmHnHWHm/EHQLvQmRMDeYZI+nx/sCJOwEAw4AKg0Oemv9y
FgeUPAD1oasg6CP+INZvCj34waNxwAc=
=E+Y4
-----END PGP SIGNATURE-----
Merge tag 'mm-stable-2023-11-01-14-33' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Pull MM updates from Andrew Morton:
"Many singleton patches against the MM code. The patch series which are
included in this merge do the following:
- Kemeng Shi has contributed some compation maintenance work in the
series 'Fixes and cleanups to compaction'
- Joel Fernandes has a patchset ('Optimize mremap during mutual
alignment within PMD') which fixes an obscure issue with mremap()'s
pagetable handling during a subsequent exec(), based upon an
implementation which Linus suggested
- More DAMON/DAMOS maintenance and feature work from SeongJae Park i
the following patch series:
mm/damon: misc fixups for documents, comments and its tracepoint
mm/damon: add a tracepoint for damos apply target regions
mm/damon: provide pseudo-moving sum based access rate
mm/damon: implement DAMOS apply intervals
mm/damon/core-test: Fix memory leaks in core-test
mm/damon/sysfs-schemes: Do DAMOS tried regions update for only one apply interval
- In the series 'Do not try to access unaccepted memory' Adrian
Hunter provides some fixups for the recently-added 'unaccepted
memory' feature. To increase the feature's checking coverage. 'Plug
a few gaps where RAM is exposed without checking if it is
unaccepted memory'
- In the series 'cleanups for lockless slab shrink' Qi Zheng has done
some maintenance work which is preparation for the lockless slab
shrinking code
- Qi Zheng has redone the earlier (and reverted) attempt to make slab
shrinking lockless in the series 'use refcount+RCU method to
implement lockless slab shrink'
- David Hildenbrand contributes some maintenance work for the rmap
code in the series 'Anon rmap cleanups'
- Kefeng Wang does more folio conversions and some maintenance work
in the migration code. Series 'mm: migrate: more folio conversion
and unification'
- Matthew Wilcox has fixed an issue in the buffer_head code which was
causing long stalls under some heavy memory/IO loads. Some cleanups
were added on the way. Series 'Add and use bdev_getblk()'
- In the series 'Use nth_page() in place of direct struct page
manipulation' Zi Yan has fixed a potential issue with the direct
manipulation of hugetlb page frames
- In the series 'mm: hugetlb: Skip initialization of gigantic tail
struct pages if freed by HVO' has improved our handling of gigantic
pages in the hugetlb vmmemmep optimizaton code. This provides
significant boot time improvements when significant amounts of
gigantic pages are in use
- Matthew Wilcox has sent the series 'Small hugetlb cleanups' - code
rationalization and folio conversions in the hugetlb code
- Yin Fengwei has improved mlock()'s handling of large folios in the
series 'support large folio for mlock'
- In the series 'Expose swapcache stat for memcg v1' Liu Shixin has
added statistics for memcg v1 users which are available (and
useful) under memcg v2
- Florent Revest has enhanced the MDWE (Memory-Deny-Write-Executable)
prctl so that userspace may direct the kernel to not automatically
propagate the denial to child processes. The series is named 'MDWE
without inheritance'
- Kefeng Wang has provided the series 'mm: convert numa balancing
functions to use a folio' which does what it says
- In the series 'mm/ksm: add fork-exec support for prctl' Stefan
Roesch makes is possible for a process to propagate KSM treatment
across exec()
- Huang Ying has enhanced memory tiering's calculation of memory
distances. This is used to permit the dax/kmem driver to use 'high
bandwidth memory' in addition to Optane Data Center Persistent
Memory Modules (DCPMM). The series is named 'memory tiering:
calculate abstract distance based on ACPI HMAT'
- In the series 'Smart scanning mode for KSM' Stefan Roesch has
optimized KSM by teaching it to retain and use some historical
information from previous scans
- Yosry Ahmed has fixed some inconsistencies in memcg statistics in
the series 'mm: memcg: fix tracking of pending stats updates
values'
- In the series 'Implement IOCTL to get and optionally clear info
about PTEs' Peter Xu has added an ioctl to /proc/<pid>/pagemap
which permits us to atomically read-then-clear page softdirty
state. This is mainly used by CRIU
- Hugh Dickins contributed the series 'shmem,tmpfs: general
maintenance', a bunch of relatively minor maintenance tweaks to
this code
- Matthew Wilcox has increased the use of the VMA lock over
file-backed page faults in the series 'Handle more faults under the
VMA lock'. Some rationalizations of the fault path became possible
as a result
- In the series 'mm/rmap: convert page_move_anon_rmap() to
folio_move_anon_rmap()' David Hildenbrand has implemented some
cleanups and folio conversions
- In the series 'various improvements to the GUP interface' Lorenzo
Stoakes has simplified and improved the GUP interface with an eye
to providing groundwork for future improvements
- Andrey Konovalov has sent along the series 'kasan: assorted fixes
and improvements' which does those things
- Some page allocator maintenance work from Kemeng Shi in the series
'Two minor cleanups to break_down_buddy_pages'
- In thes series 'New selftest for mm' Breno Leitao has developed
another MM self test which tickles a race we had between madvise()
and page faults
- In the series 'Add folio_end_read' Matthew Wilcox provides cleanups
and an optimization to the core pagecache code
- Nhat Pham has added memcg accounting for hugetlb memory in the
series 'hugetlb memcg accounting'
- Cleanups and rationalizations to the pagemap code from Lorenzo
Stoakes, in the series 'Abstract vma_merge() and split_vma()'
- Audra Mitchell has fixed issues in the procfs page_owner code's new
timestamping feature which was causing some misbehaviours. In the
series 'Fix page_owner's use of free timestamps'
- Lorenzo Stoakes has fixed the handling of new mappings of sealed
files in the series 'permit write-sealed memfd read-only shared
mappings'
- Mike Kravetz has optimized the hugetlb vmemmap optimization in the
series 'Batch hugetlb vmemmap modification operations'
- Some buffer_head folio conversions and cleanups from Matthew Wilcox
in the series 'Finish the create_empty_buffers() transition'
- As a page allocator performance optimization Huang Ying has added
automatic tuning to the allocator's per-cpu-pages feature, in the
series 'mm: PCP high auto-tuning'
- Roman Gushchin has contributed the patchset 'mm: improve
performance of accounted kernel memory allocations' which improves
their performance by ~30% as measured by a micro-benchmark
- folio conversions from Kefeng Wang in the series 'mm: convert page
cpupid functions to folios'
- Some kmemleak fixups in Liu Shixin's series 'Some bugfix about
kmemleak'
- Qi Zheng has improved our handling of memoryless nodes by keeping
them off the allocation fallback list. This is done in the series
'handle memoryless nodes more appropriately'
- khugepaged conversions from Vishal Moola in the series 'Some
khugepaged folio conversions'"
[ bcachefs conflicts with the dynamically allocated shrinkers have been
resolved as per Stephen Rothwell in
https://lore.kernel.org/all/20230913093553.4290421e@canb.auug.org.au/
with help from Qi Zheng.
The clone3 test filtering conflict was half-arsed by yours truly ]
* tag 'mm-stable-2023-11-01-14-33' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm: (406 commits)
mm/damon/sysfs: update monitoring target regions for online input commit
mm/damon/sysfs: remove requested targets when online-commit inputs
selftests: add a sanity check for zswap
Documentation: maple_tree: fix word spelling error
mm/vmalloc: fix the unchecked dereference warning in vread_iter()
zswap: export compression failure stats
Documentation: ubsan: drop "the" from article title
mempolicy: migration attempt to match interleave nodes
mempolicy: mmap_lock is not needed while migrating folios
mempolicy: alloc_pages_mpol() for NUMA policy without vma
mm: add page_rmappable_folio() wrapper
mempolicy: remove confusing MPOL_MF_LAZY dead code
mempolicy: mpol_shared_policy_init() without pseudo-vma
mempolicy trivia: use pgoff_t in shared mempolicy tree
mempolicy trivia: slightly more consistent naming
mempolicy trivia: delete those ancient pr_debug()s
mempolicy: fix migrate_pages(2) syscall return nr_failed
kernfs: drop shared NUMA mempolicy hooks
hugetlbfs: drop shared NUMA mempolicy pretence
mm/damon/sysfs-test: add a unit test for damon_sysfs_set_targets()
...
2023-11-02 22:38:47 -07:00
|
|
|
if (!shrink)
|
2023-03-14 12:35:57 -07:00
|
|
|
return -BCH_ERR_ENOMEM_fs_btree_cache_init;
|
Many singleton patches against the MM code. The patch series which are
included in this merge do the following:
- Kemeng Shi has contributed some compation maintenance work in the
series "Fixes and cleanups to compaction".
- Joel Fernandes has a patchset ("Optimize mremap during mutual
alignment within PMD") which fixes an obscure issue with mremap()'s
pagetable handling during a subsequent exec(), based upon an
implementation which Linus suggested.
- More DAMON/DAMOS maintenance and feature work from SeongJae Park i the
following patch series:
mm/damon: misc fixups for documents, comments and its tracepoint
mm/damon: add a tracepoint for damos apply target regions
mm/damon: provide pseudo-moving sum based access rate
mm/damon: implement DAMOS apply intervals
mm/damon/core-test: Fix memory leaks in core-test
mm/damon/sysfs-schemes: Do DAMOS tried regions update for only one apply interval
- In the series "Do not try to access unaccepted memory" Adrian Hunter
provides some fixups for the recently-added "unaccepted memory' feature.
To increase the feature's checking coverage. "Plug a few gaps where
RAM is exposed without checking if it is unaccepted memory".
- In the series "cleanups for lockless slab shrink" Qi Zheng has done
some maintenance work which is preparation for the lockless slab
shrinking code.
- Qi Zheng has redone the earlier (and reverted) attempt to make slab
shrinking lockless in the series "use refcount+RCU method to implement
lockless slab shrink".
- David Hildenbrand contributes some maintenance work for the rmap code
in the series "Anon rmap cleanups".
- Kefeng Wang does more folio conversions and some maintenance work in
the migration code. Series "mm: migrate: more folio conversion and
unification".
- Matthew Wilcox has fixed an issue in the buffer_head code which was
causing long stalls under some heavy memory/IO loads. Some cleanups
were added on the way. Series "Add and use bdev_getblk()".
- In the series "Use nth_page() in place of direct struct page
manipulation" Zi Yan has fixed a potential issue with the direct
manipulation of hugetlb page frames.
- In the series "mm: hugetlb: Skip initialization of gigantic tail
struct pages if freed by HVO" has improved our handling of gigantic
pages in the hugetlb vmmemmep optimizaton code. This provides
significant boot time improvements when significant amounts of gigantic
pages are in use.
- Matthew Wilcox has sent the series "Small hugetlb cleanups" - code
rationalization and folio conversions in the hugetlb code.
- Yin Fengwei has improved mlock()'s handling of large folios in the
series "support large folio for mlock"
- In the series "Expose swapcache stat for memcg v1" Liu Shixin has
added statistics for memcg v1 users which are available (and useful)
under memcg v2.
- Florent Revest has enhanced the MDWE (Memory-Deny-Write-Executable)
prctl so that userspace may direct the kernel to not automatically
propagate the denial to child processes. The series is named "MDWE
without inheritance".
- Kefeng Wang has provided the series "mm: convert numa balancing
functions to use a folio" which does what it says.
- In the series "mm/ksm: add fork-exec support for prctl" Stefan Roesch
makes is possible for a process to propagate KSM treatment across
exec().
- Huang Ying has enhanced memory tiering's calculation of memory
distances. This is used to permit the dax/kmem driver to use "high
bandwidth memory" in addition to Optane Data Center Persistent Memory
Modules (DCPMM). The series is named "memory tiering: calculate
abstract distance based on ACPI HMAT"
- In the series "Smart scanning mode for KSM" Stefan Roesch has
optimized KSM by teaching it to retain and use some historical
information from previous scans.
- Yosry Ahmed has fixed some inconsistencies in memcg statistics in the
series "mm: memcg: fix tracking of pending stats updates values".
- In the series "Implement IOCTL to get and optionally clear info about
PTEs" Peter Xu has added an ioctl to /proc/<pid>/pagemap which permits
us to atomically read-then-clear page softdirty state. This is mainly
used by CRIU.
- Hugh Dickins contributed the series "shmem,tmpfs: general maintenance"
- a bunch of relatively minor maintenance tweaks to this code.
- Matthew Wilcox has increased the use of the VMA lock over file-backed
page faults in the series "Handle more faults under the VMA lock". Some
rationalizations of the fault path became possible as a result.
- In the series "mm/rmap: convert page_move_anon_rmap() to
folio_move_anon_rmap()" David Hildenbrand has implemented some cleanups
and folio conversions.
- In the series "various improvements to the GUP interface" Lorenzo
Stoakes has simplified and improved the GUP interface with an eye to
providing groundwork for future improvements.
- Andrey Konovalov has sent along the series "kasan: assorted fixes and
improvements" which does those things.
- Some page allocator maintenance work from Kemeng Shi in the series
"Two minor cleanups to break_down_buddy_pages".
- In thes series "New selftest for mm" Breno Leitao has developed
another MM self test which tickles a race we had between madvise() and
page faults.
- In the series "Add folio_end_read" Matthew Wilcox provides cleanups
and an optimization to the core pagecache code.
- Nhat Pham has added memcg accounting for hugetlb memory in the series
"hugetlb memcg accounting".
- Cleanups and rationalizations to the pagemap code from Lorenzo
Stoakes, in the series "Abstract vma_merge() and split_vma()".
- Audra Mitchell has fixed issues in the procfs page_owner code's new
timestamping feature which was causing some misbehaviours. In the
series "Fix page_owner's use of free timestamps".
- Lorenzo Stoakes has fixed the handling of new mappings of sealed files
in the series "permit write-sealed memfd read-only shared mappings".
- Mike Kravetz has optimized the hugetlb vmemmap optimization in the
series "Batch hugetlb vmemmap modification operations".
- Some buffer_head folio conversions and cleanups from Matthew Wilcox in
the series "Finish the create_empty_buffers() transition".
- As a page allocator performance optimization Huang Ying has added
automatic tuning to the allocator's per-cpu-pages feature, in the series
"mm: PCP high auto-tuning".
- Roman Gushchin has contributed the patchset "mm: improve performance
of accounted kernel memory allocations" which improves their performance
by ~30% as measured by a micro-benchmark.
- folio conversions from Kefeng Wang in the series "mm: convert page
cpupid functions to folios".
- Some kmemleak fixups in Liu Shixin's series "Some bugfix about
kmemleak".
- Qi Zheng has improved our handling of memoryless nodes by keeping them
off the allocation fallback list. This is done in the series "handle
memoryless nodes more appropriately".
- khugepaged conversions from Vishal Moola in the series "Some
khugepaged folio conversions".
-----BEGIN PGP SIGNATURE-----
iHUEABYIAB0WIQTTMBEPP41GrTpTJgfdBJ7gKXxAjgUCZULEMwAKCRDdBJ7gKXxA
jhQHAQCYpD3g849x69DmHnHWHm/EHQLvQmRMDeYZI+nx/sCJOwEAw4AKg0Oemv9y
FgeUPAD1oasg6CP+INZvCj34waNxwAc=
=E+Y4
-----END PGP SIGNATURE-----
Merge tag 'mm-stable-2023-11-01-14-33' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Pull MM updates from Andrew Morton:
"Many singleton patches against the MM code. The patch series which are
included in this merge do the following:
- Kemeng Shi has contributed some compation maintenance work in the
series 'Fixes and cleanups to compaction'
- Joel Fernandes has a patchset ('Optimize mremap during mutual
alignment within PMD') which fixes an obscure issue with mremap()'s
pagetable handling during a subsequent exec(), based upon an
implementation which Linus suggested
- More DAMON/DAMOS maintenance and feature work from SeongJae Park i
the following patch series:
mm/damon: misc fixups for documents, comments and its tracepoint
mm/damon: add a tracepoint for damos apply target regions
mm/damon: provide pseudo-moving sum based access rate
mm/damon: implement DAMOS apply intervals
mm/damon/core-test: Fix memory leaks in core-test
mm/damon/sysfs-schemes: Do DAMOS tried regions update for only one apply interval
- In the series 'Do not try to access unaccepted memory' Adrian
Hunter provides some fixups for the recently-added 'unaccepted
memory' feature. To increase the feature's checking coverage. 'Plug
a few gaps where RAM is exposed without checking if it is
unaccepted memory'
- In the series 'cleanups for lockless slab shrink' Qi Zheng has done
some maintenance work which is preparation for the lockless slab
shrinking code
- Qi Zheng has redone the earlier (and reverted) attempt to make slab
shrinking lockless in the series 'use refcount+RCU method to
implement lockless slab shrink'
- David Hildenbrand contributes some maintenance work for the rmap
code in the series 'Anon rmap cleanups'
- Kefeng Wang does more folio conversions and some maintenance work
in the migration code. Series 'mm: migrate: more folio conversion
and unification'
- Matthew Wilcox has fixed an issue in the buffer_head code which was
causing long stalls under some heavy memory/IO loads. Some cleanups
were added on the way. Series 'Add and use bdev_getblk()'
- In the series 'Use nth_page() in place of direct struct page
manipulation' Zi Yan has fixed a potential issue with the direct
manipulation of hugetlb page frames
- In the series 'mm: hugetlb: Skip initialization of gigantic tail
struct pages if freed by HVO' has improved our handling of gigantic
pages in the hugetlb vmmemmep optimizaton code. This provides
significant boot time improvements when significant amounts of
gigantic pages are in use
- Matthew Wilcox has sent the series 'Small hugetlb cleanups' - code
rationalization and folio conversions in the hugetlb code
- Yin Fengwei has improved mlock()'s handling of large folios in the
series 'support large folio for mlock'
- In the series 'Expose swapcache stat for memcg v1' Liu Shixin has
added statistics for memcg v1 users which are available (and
useful) under memcg v2
- Florent Revest has enhanced the MDWE (Memory-Deny-Write-Executable)
prctl so that userspace may direct the kernel to not automatically
propagate the denial to child processes. The series is named 'MDWE
without inheritance'
- Kefeng Wang has provided the series 'mm: convert numa balancing
functions to use a folio' which does what it says
- In the series 'mm/ksm: add fork-exec support for prctl' Stefan
Roesch makes is possible for a process to propagate KSM treatment
across exec()
- Huang Ying has enhanced memory tiering's calculation of memory
distances. This is used to permit the dax/kmem driver to use 'high
bandwidth memory' in addition to Optane Data Center Persistent
Memory Modules (DCPMM). The series is named 'memory tiering:
calculate abstract distance based on ACPI HMAT'
- In the series 'Smart scanning mode for KSM' Stefan Roesch has
optimized KSM by teaching it to retain and use some historical
information from previous scans
- Yosry Ahmed has fixed some inconsistencies in memcg statistics in
the series 'mm: memcg: fix tracking of pending stats updates
values'
- In the series 'Implement IOCTL to get and optionally clear info
about PTEs' Peter Xu has added an ioctl to /proc/<pid>/pagemap
which permits us to atomically read-then-clear page softdirty
state. This is mainly used by CRIU
- Hugh Dickins contributed the series 'shmem,tmpfs: general
maintenance', a bunch of relatively minor maintenance tweaks to
this code
- Matthew Wilcox has increased the use of the VMA lock over
file-backed page faults in the series 'Handle more faults under the
VMA lock'. Some rationalizations of the fault path became possible
as a result
- In the series 'mm/rmap: convert page_move_anon_rmap() to
folio_move_anon_rmap()' David Hildenbrand has implemented some
cleanups and folio conversions
- In the series 'various improvements to the GUP interface' Lorenzo
Stoakes has simplified and improved the GUP interface with an eye
to providing groundwork for future improvements
- Andrey Konovalov has sent along the series 'kasan: assorted fixes
and improvements' which does those things
- Some page allocator maintenance work from Kemeng Shi in the series
'Two minor cleanups to break_down_buddy_pages'
- In thes series 'New selftest for mm' Breno Leitao has developed
another MM self test which tickles a race we had between madvise()
and page faults
- In the series 'Add folio_end_read' Matthew Wilcox provides cleanups
and an optimization to the core pagecache code
- Nhat Pham has added memcg accounting for hugetlb memory in the
series 'hugetlb memcg accounting'
- Cleanups and rationalizations to the pagemap code from Lorenzo
Stoakes, in the series 'Abstract vma_merge() and split_vma()'
- Audra Mitchell has fixed issues in the procfs page_owner code's new
timestamping feature which was causing some misbehaviours. In the
series 'Fix page_owner's use of free timestamps'
- Lorenzo Stoakes has fixed the handling of new mappings of sealed
files in the series 'permit write-sealed memfd read-only shared
mappings'
- Mike Kravetz has optimized the hugetlb vmemmap optimization in the
series 'Batch hugetlb vmemmap modification operations'
- Some buffer_head folio conversions and cleanups from Matthew Wilcox
in the series 'Finish the create_empty_buffers() transition'
- As a page allocator performance optimization Huang Ying has added
automatic tuning to the allocator's per-cpu-pages feature, in the
series 'mm: PCP high auto-tuning'
- Roman Gushchin has contributed the patchset 'mm: improve
performance of accounted kernel memory allocations' which improves
their performance by ~30% as measured by a micro-benchmark
- folio conversions from Kefeng Wang in the series 'mm: convert page
cpupid functions to folios'
- Some kmemleak fixups in Liu Shixin's series 'Some bugfix about
kmemleak'
- Qi Zheng has improved our handling of memoryless nodes by keeping
them off the allocation fallback list. This is done in the series
'handle memoryless nodes more appropriately'
- khugepaged conversions from Vishal Moola in the series 'Some
khugepaged folio conversions'"
[ bcachefs conflicts with the dynamically allocated shrinkers have been
resolved as per Stephen Rothwell in
https://lore.kernel.org/all/20230913093553.4290421e@canb.auug.org.au/
with help from Qi Zheng.
The clone3 test filtering conflict was half-arsed by yours truly ]
* tag 'mm-stable-2023-11-01-14-33' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm: (406 commits)
mm/damon/sysfs: update monitoring target regions for online input commit
mm/damon/sysfs: remove requested targets when online-commit inputs
selftests: add a sanity check for zswap
Documentation: maple_tree: fix word spelling error
mm/vmalloc: fix the unchecked dereference warning in vread_iter()
zswap: export compression failure stats
Documentation: ubsan: drop "the" from article title
mempolicy: migration attempt to match interleave nodes
mempolicy: mmap_lock is not needed while migrating folios
mempolicy: alloc_pages_mpol() for NUMA policy without vma
mm: add page_rmappable_folio() wrapper
mempolicy: remove confusing MPOL_MF_LAZY dead code
mempolicy: mpol_shared_policy_init() without pseudo-vma
mempolicy trivia: use pgoff_t in shared mempolicy tree
mempolicy trivia: slightly more consistent naming
mempolicy trivia: delete those ancient pr_debug()s
mempolicy: fix migrate_pages(2) syscall return nr_failed
kernfs: drop shared NUMA mempolicy hooks
hugetlbfs: drop shared NUMA mempolicy pretence
mm/damon/sysfs-test: add a unit test for damon_sysfs_set_targets()
...
2023-11-02 22:38:47 -07:00
|
|
|
bc->shrink = shrink;
|
|
|
|
shrink->count_objects = bch2_btree_key_cache_count;
|
|
|
|
shrink->scan_objects = bch2_btree_key_cache_scan;
|
2024-06-06 16:12:11 -07:00
|
|
|
shrink->batch = 1 << 14;
|
|
|
|
shrink->seeks = 0;
|
Many singleton patches against the MM code. The patch series which are
included in this merge do the following:
- Kemeng Shi has contributed some compation maintenance work in the
series "Fixes and cleanups to compaction".
- Joel Fernandes has a patchset ("Optimize mremap during mutual
alignment within PMD") which fixes an obscure issue with mremap()'s
pagetable handling during a subsequent exec(), based upon an
implementation which Linus suggested.
- More DAMON/DAMOS maintenance and feature work from SeongJae Park i the
following patch series:
mm/damon: misc fixups for documents, comments and its tracepoint
mm/damon: add a tracepoint for damos apply target regions
mm/damon: provide pseudo-moving sum based access rate
mm/damon: implement DAMOS apply intervals
mm/damon/core-test: Fix memory leaks in core-test
mm/damon/sysfs-schemes: Do DAMOS tried regions update for only one apply interval
- In the series "Do not try to access unaccepted memory" Adrian Hunter
provides some fixups for the recently-added "unaccepted memory' feature.
To increase the feature's checking coverage. "Plug a few gaps where
RAM is exposed without checking if it is unaccepted memory".
- In the series "cleanups for lockless slab shrink" Qi Zheng has done
some maintenance work which is preparation for the lockless slab
shrinking code.
- Qi Zheng has redone the earlier (and reverted) attempt to make slab
shrinking lockless in the series "use refcount+RCU method to implement
lockless slab shrink".
- David Hildenbrand contributes some maintenance work for the rmap code
in the series "Anon rmap cleanups".
- Kefeng Wang does more folio conversions and some maintenance work in
the migration code. Series "mm: migrate: more folio conversion and
unification".
- Matthew Wilcox has fixed an issue in the buffer_head code which was
causing long stalls under some heavy memory/IO loads. Some cleanups
were added on the way. Series "Add and use bdev_getblk()".
- In the series "Use nth_page() in place of direct struct page
manipulation" Zi Yan has fixed a potential issue with the direct
manipulation of hugetlb page frames.
- In the series "mm: hugetlb: Skip initialization of gigantic tail
struct pages if freed by HVO" has improved our handling of gigantic
pages in the hugetlb vmmemmep optimizaton code. This provides
significant boot time improvements when significant amounts of gigantic
pages are in use.
- Matthew Wilcox has sent the series "Small hugetlb cleanups" - code
rationalization and folio conversions in the hugetlb code.
- Yin Fengwei has improved mlock()'s handling of large folios in the
series "support large folio for mlock"
- In the series "Expose swapcache stat for memcg v1" Liu Shixin has
added statistics for memcg v1 users which are available (and useful)
under memcg v2.
- Florent Revest has enhanced the MDWE (Memory-Deny-Write-Executable)
prctl so that userspace may direct the kernel to not automatically
propagate the denial to child processes. The series is named "MDWE
without inheritance".
- Kefeng Wang has provided the series "mm: convert numa balancing
functions to use a folio" which does what it says.
- In the series "mm/ksm: add fork-exec support for prctl" Stefan Roesch
makes is possible for a process to propagate KSM treatment across
exec().
- Huang Ying has enhanced memory tiering's calculation of memory
distances. This is used to permit the dax/kmem driver to use "high
bandwidth memory" in addition to Optane Data Center Persistent Memory
Modules (DCPMM). The series is named "memory tiering: calculate
abstract distance based on ACPI HMAT"
- In the series "Smart scanning mode for KSM" Stefan Roesch has
optimized KSM by teaching it to retain and use some historical
information from previous scans.
- Yosry Ahmed has fixed some inconsistencies in memcg statistics in the
series "mm: memcg: fix tracking of pending stats updates values".
- In the series "Implement IOCTL to get and optionally clear info about
PTEs" Peter Xu has added an ioctl to /proc/<pid>/pagemap which permits
us to atomically read-then-clear page softdirty state. This is mainly
used by CRIU.
- Hugh Dickins contributed the series "shmem,tmpfs: general maintenance"
- a bunch of relatively minor maintenance tweaks to this code.
- Matthew Wilcox has increased the use of the VMA lock over file-backed
page faults in the series "Handle more faults under the VMA lock". Some
rationalizations of the fault path became possible as a result.
- In the series "mm/rmap: convert page_move_anon_rmap() to
folio_move_anon_rmap()" David Hildenbrand has implemented some cleanups
and folio conversions.
- In the series "various improvements to the GUP interface" Lorenzo
Stoakes has simplified and improved the GUP interface with an eye to
providing groundwork for future improvements.
- Andrey Konovalov has sent along the series "kasan: assorted fixes and
improvements" which does those things.
- Some page allocator maintenance work from Kemeng Shi in the series
"Two minor cleanups to break_down_buddy_pages".
- In thes series "New selftest for mm" Breno Leitao has developed
another MM self test which tickles a race we had between madvise() and
page faults.
- In the series "Add folio_end_read" Matthew Wilcox provides cleanups
and an optimization to the core pagecache code.
- Nhat Pham has added memcg accounting for hugetlb memory in the series
"hugetlb memcg accounting".
- Cleanups and rationalizations to the pagemap code from Lorenzo
Stoakes, in the series "Abstract vma_merge() and split_vma()".
- Audra Mitchell has fixed issues in the procfs page_owner code's new
timestamping feature which was causing some misbehaviours. In the
series "Fix page_owner's use of free timestamps".
- Lorenzo Stoakes has fixed the handling of new mappings of sealed files
in the series "permit write-sealed memfd read-only shared mappings".
- Mike Kravetz has optimized the hugetlb vmemmap optimization in the
series "Batch hugetlb vmemmap modification operations".
- Some buffer_head folio conversions and cleanups from Matthew Wilcox in
the series "Finish the create_empty_buffers() transition".
- As a page allocator performance optimization Huang Ying has added
automatic tuning to the allocator's per-cpu-pages feature, in the series
"mm: PCP high auto-tuning".
- Roman Gushchin has contributed the patchset "mm: improve performance
of accounted kernel memory allocations" which improves their performance
by ~30% as measured by a micro-benchmark.
- folio conversions from Kefeng Wang in the series "mm: convert page
cpupid functions to folios".
- Some kmemleak fixups in Liu Shixin's series "Some bugfix about
kmemleak".
- Qi Zheng has improved our handling of memoryless nodes by keeping them
off the allocation fallback list. This is done in the series "handle
memoryless nodes more appropriately".
- khugepaged conversions from Vishal Moola in the series "Some
khugepaged folio conversions".
-----BEGIN PGP SIGNATURE-----
iHUEABYIAB0WIQTTMBEPP41GrTpTJgfdBJ7gKXxAjgUCZULEMwAKCRDdBJ7gKXxA
jhQHAQCYpD3g849x69DmHnHWHm/EHQLvQmRMDeYZI+nx/sCJOwEAw4AKg0Oemv9y
FgeUPAD1oasg6CP+INZvCj34waNxwAc=
=E+Y4
-----END PGP SIGNATURE-----
Merge tag 'mm-stable-2023-11-01-14-33' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Pull MM updates from Andrew Morton:
"Many singleton patches against the MM code. The patch series which are
included in this merge do the following:
- Kemeng Shi has contributed some compation maintenance work in the
series 'Fixes and cleanups to compaction'
- Joel Fernandes has a patchset ('Optimize mremap during mutual
alignment within PMD') which fixes an obscure issue with mremap()'s
pagetable handling during a subsequent exec(), based upon an
implementation which Linus suggested
- More DAMON/DAMOS maintenance and feature work from SeongJae Park i
the following patch series:
mm/damon: misc fixups for documents, comments and its tracepoint
mm/damon: add a tracepoint for damos apply target regions
mm/damon: provide pseudo-moving sum based access rate
mm/damon: implement DAMOS apply intervals
mm/damon/core-test: Fix memory leaks in core-test
mm/damon/sysfs-schemes: Do DAMOS tried regions update for only one apply interval
- In the series 'Do not try to access unaccepted memory' Adrian
Hunter provides some fixups for the recently-added 'unaccepted
memory' feature. To increase the feature's checking coverage. 'Plug
a few gaps where RAM is exposed without checking if it is
unaccepted memory'
- In the series 'cleanups for lockless slab shrink' Qi Zheng has done
some maintenance work which is preparation for the lockless slab
shrinking code
- Qi Zheng has redone the earlier (and reverted) attempt to make slab
shrinking lockless in the series 'use refcount+RCU method to
implement lockless slab shrink'
- David Hildenbrand contributes some maintenance work for the rmap
code in the series 'Anon rmap cleanups'
- Kefeng Wang does more folio conversions and some maintenance work
in the migration code. Series 'mm: migrate: more folio conversion
and unification'
- Matthew Wilcox has fixed an issue in the buffer_head code which was
causing long stalls under some heavy memory/IO loads. Some cleanups
were added on the way. Series 'Add and use bdev_getblk()'
- In the series 'Use nth_page() in place of direct struct page
manipulation' Zi Yan has fixed a potential issue with the direct
manipulation of hugetlb page frames
- In the series 'mm: hugetlb: Skip initialization of gigantic tail
struct pages if freed by HVO' has improved our handling of gigantic
pages in the hugetlb vmmemmep optimizaton code. This provides
significant boot time improvements when significant amounts of
gigantic pages are in use
- Matthew Wilcox has sent the series 'Small hugetlb cleanups' - code
rationalization and folio conversions in the hugetlb code
- Yin Fengwei has improved mlock()'s handling of large folios in the
series 'support large folio for mlock'
- In the series 'Expose swapcache stat for memcg v1' Liu Shixin has
added statistics for memcg v1 users which are available (and
useful) under memcg v2
- Florent Revest has enhanced the MDWE (Memory-Deny-Write-Executable)
prctl so that userspace may direct the kernel to not automatically
propagate the denial to child processes. The series is named 'MDWE
without inheritance'
- Kefeng Wang has provided the series 'mm: convert numa balancing
functions to use a folio' which does what it says
- In the series 'mm/ksm: add fork-exec support for prctl' Stefan
Roesch makes is possible for a process to propagate KSM treatment
across exec()
- Huang Ying has enhanced memory tiering's calculation of memory
distances. This is used to permit the dax/kmem driver to use 'high
bandwidth memory' in addition to Optane Data Center Persistent
Memory Modules (DCPMM). The series is named 'memory tiering:
calculate abstract distance based on ACPI HMAT'
- In the series 'Smart scanning mode for KSM' Stefan Roesch has
optimized KSM by teaching it to retain and use some historical
information from previous scans
- Yosry Ahmed has fixed some inconsistencies in memcg statistics in
the series 'mm: memcg: fix tracking of pending stats updates
values'
- In the series 'Implement IOCTL to get and optionally clear info
about PTEs' Peter Xu has added an ioctl to /proc/<pid>/pagemap
which permits us to atomically read-then-clear page softdirty
state. This is mainly used by CRIU
- Hugh Dickins contributed the series 'shmem,tmpfs: general
maintenance', a bunch of relatively minor maintenance tweaks to
this code
- Matthew Wilcox has increased the use of the VMA lock over
file-backed page faults in the series 'Handle more faults under the
VMA lock'. Some rationalizations of the fault path became possible
as a result
- In the series 'mm/rmap: convert page_move_anon_rmap() to
folio_move_anon_rmap()' David Hildenbrand has implemented some
cleanups and folio conversions
- In the series 'various improvements to the GUP interface' Lorenzo
Stoakes has simplified and improved the GUP interface with an eye
to providing groundwork for future improvements
- Andrey Konovalov has sent along the series 'kasan: assorted fixes
and improvements' which does those things
- Some page allocator maintenance work from Kemeng Shi in the series
'Two minor cleanups to break_down_buddy_pages'
- In thes series 'New selftest for mm' Breno Leitao has developed
another MM self test which tickles a race we had between madvise()
and page faults
- In the series 'Add folio_end_read' Matthew Wilcox provides cleanups
and an optimization to the core pagecache code
- Nhat Pham has added memcg accounting for hugetlb memory in the
series 'hugetlb memcg accounting'
- Cleanups and rationalizations to the pagemap code from Lorenzo
Stoakes, in the series 'Abstract vma_merge() and split_vma()'
- Audra Mitchell has fixed issues in the procfs page_owner code's new
timestamping feature which was causing some misbehaviours. In the
series 'Fix page_owner's use of free timestamps'
- Lorenzo Stoakes has fixed the handling of new mappings of sealed
files in the series 'permit write-sealed memfd read-only shared
mappings'
- Mike Kravetz has optimized the hugetlb vmemmap optimization in the
series 'Batch hugetlb vmemmap modification operations'
- Some buffer_head folio conversions and cleanups from Matthew Wilcox
in the series 'Finish the create_empty_buffers() transition'
- As a page allocator performance optimization Huang Ying has added
automatic tuning to the allocator's per-cpu-pages feature, in the
series 'mm: PCP high auto-tuning'
- Roman Gushchin has contributed the patchset 'mm: improve
performance of accounted kernel memory allocations' which improves
their performance by ~30% as measured by a micro-benchmark
- folio conversions from Kefeng Wang in the series 'mm: convert page
cpupid functions to folios'
- Some kmemleak fixups in Liu Shixin's series 'Some bugfix about
kmemleak'
- Qi Zheng has improved our handling of memoryless nodes by keeping
them off the allocation fallback list. This is done in the series
'handle memoryless nodes more appropriately'
- khugepaged conversions from Vishal Moola in the series 'Some
khugepaged folio conversions'"
[ bcachefs conflicts with the dynamically allocated shrinkers have been
resolved as per Stephen Rothwell in
https://lore.kernel.org/all/20230913093553.4290421e@canb.auug.org.au/
with help from Qi Zheng.
The clone3 test filtering conflict was half-arsed by yours truly ]
* tag 'mm-stable-2023-11-01-14-33' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm: (406 commits)
mm/damon/sysfs: update monitoring target regions for online input commit
mm/damon/sysfs: remove requested targets when online-commit inputs
selftests: add a sanity check for zswap
Documentation: maple_tree: fix word spelling error
mm/vmalloc: fix the unchecked dereference warning in vread_iter()
zswap: export compression failure stats
Documentation: ubsan: drop "the" from article title
mempolicy: migration attempt to match interleave nodes
mempolicy: mmap_lock is not needed while migrating folios
mempolicy: alloc_pages_mpol() for NUMA policy without vma
mm: add page_rmappable_folio() wrapper
mempolicy: remove confusing MPOL_MF_LAZY dead code
mempolicy: mpol_shared_policy_init() without pseudo-vma
mempolicy trivia: use pgoff_t in shared mempolicy tree
mempolicy trivia: slightly more consistent naming
mempolicy trivia: delete those ancient pr_debug()s
mempolicy: fix migrate_pages(2) syscall return nr_failed
kernfs: drop shared NUMA mempolicy hooks
hugetlbfs: drop shared NUMA mempolicy pretence
mm/damon/sysfs-test: add a unit test for damon_sysfs_set_targets()
...
2023-11-02 22:38:47 -07:00
|
|
|
shrink->private_data = c;
|
|
|
|
shrinker_register(shrink);
|
2023-03-14 12:35:57 -07:00
|
|
|
return 0;
|
2019-03-07 17:46:10 -07:00
|
|
|
}
|
2020-06-15 16:53:46 -07:00
|
|
|
|
2024-04-20 11:49:22 -07:00
|
|
|
void bch2_btree_key_cache_to_text(struct printbuf *out, struct btree_key_cache *bc)
|
2020-06-15 16:53:46 -07:00
|
|
|
{
|
2024-04-20 11:49:22 -07:00
|
|
|
printbuf_tabstop_push(out, 24);
|
|
|
|
printbuf_tabstop_push(out, 12);
|
|
|
|
|
|
|
|
prt_printf(out, "keys:\t%lu\r\n", atomic_long_read(&bc->nr_keys));
|
|
|
|
prt_printf(out, "dirty:\t%lu\r\n", atomic_long_read(&bc->nr_dirty));
|
2024-06-08 19:32:40 -07:00
|
|
|
prt_printf(out, "table size:\t%u\r\n", bc->table.tbl->size);
|
2024-06-13 12:35:47 -07:00
|
|
|
prt_newline(out);
|
|
|
|
prt_printf(out, "shrinker:\n");
|
2024-04-20 11:49:22 -07:00
|
|
|
prt_printf(out, "requested_to_free:\t%lu\r\n", bc->requested_to_free);
|
|
|
|
prt_printf(out, "freed:\t%lu\r\n", bc->freed);
|
|
|
|
prt_printf(out, "skipped_dirty:\t%lu\r\n", bc->skipped_dirty);
|
|
|
|
prt_printf(out, "skipped_accessed:\t%lu\r\n", bc->skipped_accessed);
|
|
|
|
prt_printf(out, "skipped_lock_fail:\t%lu\r\n", bc->skipped_lock_fail);
|
2024-06-13 12:35:47 -07:00
|
|
|
prt_newline(out);
|
bcachefs: Fix format specifier in bch2_btree_key_cache_to_text()
When building for a 32-bit architecture, for which 'size_t' is
'unsigned int', there is a compiler warning due to use of '%lu':
In file included from fs/bcachefs/vstructs.h:5,
from fs/bcachefs/bcachefs_format.h:80,
from fs/bcachefs/bcachefs.h:207,
from fs/bcachefs/btree_key_cache.c:3:
fs/bcachefs/btree_key_cache.c: In function 'bch2_btree_key_cache_to_text':
fs/bcachefs/btree_key_cache.c:795:25: error: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'size_t' {aka 'unsigned int'} [-Werror=format=]
795 | prt_printf(out, "pending:\t%lu\r\n", per_cpu_sum(bc->nr_pending));
| ^~~~~~~~~~~~~~~~~~~
fs/bcachefs/util.h:78:63: note: in definition of macro 'prt_printf'
78 | #define prt_printf(_out, ...) bch2_prt_printf(_out, __VA_ARGS__)
| ^~~~~~~~~~~
fs/bcachefs/btree_key_cache.c:795:38: note: format string is defined here
795 | prt_printf(out, "pending:\t%lu\r\n", per_cpu_sum(bc->nr_pending));
| ~~^
| |
| long unsigned int
| %u
cc1: all warnings being treated as errors
Use the proper specifier, '%zu', to resolve the warning.
Fixes: e447e49977b8 ("bcachefs: key cache can now allocate from pending")
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-08-21 13:43:03 -07:00
|
|
|
prt_printf(out, "pending:\t%zu\r\n", per_cpu_sum(bc->nr_pending));
|
2020-06-15 16:53:46 -07:00
|
|
|
}
|
2020-11-18 12:09:33 -07:00
|
|
|
|
|
|
|
void bch2_btree_key_cache_exit(void)
|
|
|
|
{
|
2022-10-19 15:31:33 -07:00
|
|
|
kmem_cache_destroy(bch2_key_cache);
|
2020-11-18 12:09:33 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
int __init bch2_btree_key_cache_init(void)
|
|
|
|
{
|
2023-07-13 09:00:28 -07:00
|
|
|
bch2_key_cache = KMEM_CACHE(bkey_cached, SLAB_RECLAIM_ACCOUNT);
|
2020-11-18 12:09:33 -07:00
|
|
|
if (!bch2_key_cache)
|
|
|
|
return -ENOMEM;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|