-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
27 changed files
with
377 additions
and
1,992 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
44 changes: 0 additions & 44 deletions
44
patch/cl/0001-mm-memcontrol-add-some-branch-hints-based-on-gcov-an.patch
This file was deleted.
Oops, something went wrong.
232 changes: 232 additions & 0 deletions
232
patch/cl/0050-Revert-ext4-do-not-create-EA-inode-under-buffer-lock.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,232 @@ | ||
From c13c0e90c89beccfc740aad680f324c1aa6da590 Mon Sep 17 00:00:00 2001 | ||
From: Colin Ian King <[email protected]> | ||
Date: Thu, 24 Oct 2024 12:11:04 +0100 | ||
Subject: [PATCH] Revert "ext4: do not create EA inode under buffer lock" | ||
|
||
Currenlty this commit makes it much easier to hit an ABBA lock | ||
bug, so reverting it reduces this risk, even though it's not | ||
a final solution. | ||
|
||
See: https://bugzilla.kernel.org/show_bug.cgi?id=219283 | ||
|
||
This reverts commit 0a46ef234756dca04623b7591e8ebb3440622f0b. | ||
--- | ||
fs/ext4/xattr.c | 113 +++++++++++++++++++++++++----------------------- | ||
1 file changed, 60 insertions(+), 53 deletions(-) | ||
|
||
diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c | ||
index 46ce2f21fef9..d2feef9793d0 100644 | ||
--- a/fs/ext4/xattr.c | ||
+++ b/fs/ext4/xattr.c | ||
@@ -1625,7 +1625,6 @@ static struct inode *ext4_xattr_inode_lookup_create(handle_t *handle, | ||
static int ext4_xattr_set_entry(struct ext4_xattr_info *i, | ||
struct ext4_xattr_search *s, | ||
handle_t *handle, struct inode *inode, | ||
- struct inode *new_ea_inode, | ||
bool is_block) | ||
{ | ||
struct ext4_xattr_entry *last, *next; | ||
@@ -1633,6 +1632,7 @@ static int ext4_xattr_set_entry(struct ext4_xattr_info *i, | ||
size_t min_offs = s->end - s->base, name_len = strlen(i->name); | ||
int in_inode = i->in_inode; | ||
struct inode *old_ea_inode = NULL; | ||
+ struct inode *new_ea_inode = NULL; | ||
size_t old_size, new_size; | ||
int ret; | ||
|
||
@@ -1717,11 +1717,38 @@ static int ext4_xattr_set_entry(struct ext4_xattr_info *i, | ||
old_ea_inode = NULL; | ||
goto out; | ||
} | ||
+ } | ||
+ if (i->value && in_inode) { | ||
+ WARN_ON_ONCE(!i->value_len); | ||
+ | ||
+ new_ea_inode = ext4_xattr_inode_lookup_create(handle, inode, | ||
+ i->value, i->value_len); | ||
+ if (IS_ERR(new_ea_inode)) { | ||
+ ret = PTR_ERR(new_ea_inode); | ||
+ new_ea_inode = NULL; | ||
+ goto out; | ||
+ } | ||
+ } | ||
|
||
+ if (old_ea_inode) { | ||
/* We are ready to release ref count on the old_ea_inode. */ | ||
ret = ext4_xattr_inode_dec_ref(handle, old_ea_inode); | ||
- if (ret) | ||
+ if (ret) { | ||
+ /* Release newly required ref count on new_ea_inode. */ | ||
+ if (new_ea_inode) { | ||
+ int err; | ||
+ | ||
+ err = ext4_xattr_inode_dec_ref(handle, | ||
+ new_ea_inode); | ||
+ if (err) | ||
+ ext4_warning_inode(new_ea_inode, | ||
+ "dec ref new_ea_inode err=%d", | ||
+ err); | ||
+ ext4_xattr_inode_free_quota(inode, new_ea_inode, | ||
+ i->value_len); | ||
+ } | ||
goto out; | ||
+ } | ||
|
||
ext4_xattr_inode_free_quota(inode, old_ea_inode, | ||
le32_to_cpu(here->e_value_size)); | ||
@@ -1845,6 +1872,7 @@ static int ext4_xattr_set_entry(struct ext4_xattr_info *i, | ||
ret = 0; | ||
out: | ||
iput(old_ea_inode); | ||
+ iput(new_ea_inode); | ||
return ret; | ||
} | ||
|
||
@@ -1907,20 +1935,8 @@ ext4_xattr_block_set(handle_t *handle, struct inode *inode, | ||
size_t old_ea_inode_quota = 0; | ||
unsigned int ea_ino; | ||
|
||
-#define header(x) ((struct ext4_xattr_header *)(x)) | ||
- | ||
- /* If we need EA inode, prepare it before locking the buffer */ | ||
- if (i->value && i->in_inode) { | ||
- WARN_ON_ONCE(!i->value_len); | ||
|
||
- ea_inode = ext4_xattr_inode_lookup_create(handle, inode, | ||
- i->value, i->value_len); | ||
- if (IS_ERR(ea_inode)) { | ||
- error = PTR_ERR(ea_inode); | ||
- ea_inode = NULL; | ||
- goto cleanup; | ||
- } | ||
- } | ||
+#define header(x) ((struct ext4_xattr_header *)(x)) | ||
|
||
if (s->base) { | ||
int offset = (char *)s->here - bs->bh->b_data; | ||
@@ -1930,7 +1946,6 @@ ext4_xattr_block_set(handle_t *handle, struct inode *inode, | ||
EXT4_JTR_NONE); | ||
if (error) | ||
goto cleanup; | ||
- | ||
lock_buffer(bs->bh); | ||
|
||
if (header(s->base)->h_refcount == cpu_to_le32(1)) { | ||
@@ -1957,7 +1972,7 @@ ext4_xattr_block_set(handle_t *handle, struct inode *inode, | ||
} | ||
ea_bdebug(bs->bh, "modifying in-place"); | ||
error = ext4_xattr_set_entry(i, s, handle, inode, | ||
- ea_inode, true /* is_block */); | ||
+ true /* is_block */); | ||
ext4_xattr_block_csum_set(inode, bs->bh); | ||
unlock_buffer(bs->bh); | ||
if (error == -EFSCORRUPTED) | ||
@@ -2025,13 +2040,29 @@ ext4_xattr_block_set(handle_t *handle, struct inode *inode, | ||
s->end = s->base + sb->s_blocksize; | ||
} | ||
|
||
- error = ext4_xattr_set_entry(i, s, handle, inode, ea_inode, | ||
- true /* is_block */); | ||
+ error = ext4_xattr_set_entry(i, s, handle, inode, true /* is_block */); | ||
if (error == -EFSCORRUPTED) | ||
goto bad_block; | ||
if (error) | ||
goto cleanup; | ||
|
||
+ if (i->value && s->here->e_value_inum) { | ||
+ /* | ||
+ * A ref count on ea_inode has been taken as part of the call to | ||
+ * ext4_xattr_set_entry() above. We would like to drop this | ||
+ * extra ref but we have to wait until the xattr block is | ||
+ * initialized and has its own ref count on the ea_inode. | ||
+ */ | ||
+ ea_ino = le32_to_cpu(s->here->e_value_inum); | ||
+ error = ext4_xattr_inode_iget(inode, ea_ino, | ||
+ le32_to_cpu(s->here->e_hash), | ||
+ &ea_inode); | ||
+ if (error) { | ||
+ ea_inode = NULL; | ||
+ goto cleanup; | ||
+ } | ||
+ } | ||
+ | ||
inserted: | ||
if (!IS_LAST_ENTRY(s->first)) { | ||
new_bh = ext4_xattr_block_cache_find(inode, header(s->base), &ce); | ||
@@ -2189,16 +2220,17 @@ ext4_xattr_block_set(handle_t *handle, struct inode *inode, | ||
|
||
cleanup: | ||
if (ea_inode) { | ||
- if (error) { | ||
- int error2; | ||
+ int error2; | ||
+ | ||
+ error2 = ext4_xattr_inode_dec_ref(handle, ea_inode); | ||
+ if (error2) | ||
+ ext4_warning_inode(ea_inode, "dec ref error=%d", | ||
+ error2); | ||
|
||
- error2 = ext4_xattr_inode_dec_ref(handle, ea_inode); | ||
- if (error2) | ||
- ext4_warning_inode(ea_inode, "dec ref error=%d", | ||
- error2); | ||
+ /* If there was an error, revert the quota charge. */ | ||
+ if (error) | ||
ext4_xattr_inode_free_quota(inode, ea_inode, | ||
i_size_read(ea_inode)); | ||
- } | ||
iput(ea_inode); | ||
} | ||
if (ce) | ||
@@ -2256,38 +2288,14 @@ int ext4_xattr_ibody_set(handle_t *handle, struct inode *inode, | ||
{ | ||
struct ext4_xattr_ibody_header *header; | ||
struct ext4_xattr_search *s = &is->s; | ||
- struct inode *ea_inode = NULL; | ||
int error; | ||
|
||
if (!EXT4_INODE_HAS_XATTR_SPACE(inode)) | ||
return -ENOSPC; | ||
|
||
- /* If we need EA inode, prepare it before locking the buffer */ | ||
- if (i->value && i->in_inode) { | ||
- WARN_ON_ONCE(!i->value_len); | ||
- | ||
- ea_inode = ext4_xattr_inode_lookup_create(handle, inode, | ||
- i->value, i->value_len); | ||
- if (IS_ERR(ea_inode)) | ||
- return PTR_ERR(ea_inode); | ||
- } | ||
- error = ext4_xattr_set_entry(i, s, handle, inode, ea_inode, | ||
- false /* is_block */); | ||
- if (error) { | ||
- if (ea_inode) { | ||
- int error2; | ||
- | ||
- error2 = ext4_xattr_inode_dec_ref(handle, ea_inode); | ||
- if (error2) | ||
- ext4_warning_inode(ea_inode, "dec ref error=%d", | ||
- error2); | ||
- | ||
- ext4_xattr_inode_free_quota(inode, ea_inode, | ||
- i_size_read(ea_inode)); | ||
- iput(ea_inode); | ||
- } | ||
+ error = ext4_xattr_set_entry(i, s, handle, inode, false /* is_block */); | ||
+ if (error) | ||
return error; | ||
- } | ||
header = IHDR(inode, ext4_raw_inode(&is->iloc)); | ||
if (!IS_LAST_ENTRY(s->first)) { | ||
header->h_magic = cpu_to_le32(EXT4_XATTR_MAGIC); | ||
@@ -2296,7 +2304,6 @@ int ext4_xattr_ibody_set(handle_t *handle, struct inode *inode, | ||
header->h_magic = cpu_to_le32(0); | ||
ext4_clear_inode_state(inode, EXT4_STATE_XATTR); | ||
} | ||
- iput(ea_inode); | ||
return 0; | ||
} | ||
|
||
-- | ||
2.47.0 | ||
|
31 changes: 0 additions & 31 deletions
31
patch/cl/0107-bootstats-add-printk-s-to-measure-boot-time-in-more-.patch
This file was deleted.
Oops, something went wrong.
28 changes: 28 additions & 0 deletions
28
patch/cl/0167-net-sock-increase-default-number-of-_SK_MEM_PACKETS-.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
From 4ba5a01513a6b3487613e7186cac4f3f2f4c5091 Mon Sep 17 00:00:00 2001 | ||
From: Colin Ian King <[email protected]> | ||
Date: Wed, 24 Apr 2024 16:45:47 +0100 | ||
Subject: [PATCH] net: sock: increase default number of _SK_MEM_PACKETS to 1024 | ||
|
||
scale these by a factor of 4 to improve socket performance | ||
|
||
Signed-off-by: Colin Ian King <[email protected]> | ||
--- | ||
include/net/sock.h | 2 +- | ||
1 file changed, 1 insertion(+), 1 deletion(-) | ||
|
||
diff --git a/include/net/sock.h b/include/net/sock.h | ||
index 54ca8dcbfb43..9adc51e8085b 100644 | ||
--- a/include/net/sock.h | ||
+++ b/include/net/sock.h | ||
@@ -2903,7 +2903,7 @@ void sk_get_meminfo(const struct sock *sk, u32 *meminfo); | ||
* platforms. This makes socket queueing behavior and performance | ||
* not depend upon such differences. | ||
*/ | ||
-#define _SK_MEM_PACKETS 256 | ||
+#define _SK_MEM_PACKETS 1024 | ||
#define _SK_MEM_OVERHEAD SKB_TRUESIZE(256) | ||
#define SK_WMEM_MAX (_SK_MEM_OVERHEAD * _SK_MEM_PACKETS) | ||
#define SK_RMEM_MAX (_SK_MEM_OVERHEAD * _SK_MEM_PACKETS) | ||
-- | ||
2.44.0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,23 @@ | ||
From 467904416b3786c9f2b29ca683d36cb2523ae7ce Mon Sep 17 00:00:00 2001 | ||
From: Colin Ian King <[email protected]> | ||
Date: Thu, 17 Oct 2024 16:29:50 +0100 | ||
Subject: [PATCH] handle sched_yield gracefully when being hammered | ||
|
||
Some misguided apps hammer sched_yield() in a tight loop (they should be using futexes instead) | ||
which causes massive lock contention even if there is little work to do or to yield to. | ||
rare limit yielding since the base scheduler does a pretty good job already about just | ||
running the right things | ||
|
||
Signed-off-by: Colin Ian King <[email protected]> | ||
--- | ||
kernel/sched/syscalls.c | 12 ++++++++++++ | ||
1 file changed, 12 insertions(+) | ||
|
||
--- linux-6.2.11/kernel/sched/core.c 2023-04-13 15:02:59.000000000 +0000 | ||
+++ linux-6.2.6/kernel/sched/core.c 2023-04-19 14:55:44.284309871 +0000 | ||
@@ -8421,10 +8418,22 @@ | ||
diff --git a/kernel/sched/syscalls.c b/kernel/sched/syscalls.c | ||
index ae1b42775ef9..441ac65f4f15 100644 | ||
--- a/kernel/sched/syscalls.c | ||
+++ b/kernel/sched/syscalls.c | ||
@@ -1456,10 +1456,22 @@ SYSCALL_DEFINE3(sched_getaffinity, pid_t, pid, unsigned int, len, | ||
return ret; | ||
} | ||
|
||
|
@@ -21,11 +32,13 @@ running the right things | |
+ cond_resched(); | ||
+ | ||
+ /* rate limit yielding to something sensible */ | ||
+ | ||
+ | ||
+ if (unlikely(!time_after(jiffies, per_cpu(last_yield, cpu)))) | ||
+ return; | ||
+ | ||
+ | ||
+ per_cpu(last_yield, cpu) = jiffies; | ||
|
||
rq = this_rq_lock_irq(&rf); | ||
|
||
-- | ||
2.46.2 |
Oops, something went wrong.