-
Notifications
You must be signed in to change notification settings - Fork 103
[Deepin-Kernel-SIG] [linux 6.6-y] [Upstream] Add folio_end_read #690
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
opsiff
wants to merge
17
commits into
deepin-community:linux-6.6.y
Choose a base branch
from
opsiff:linux-6.6.y-2025-03-26-folio
base: linux-6.6.y
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
1851613
iomap: hold state_lock over call to ifs_set_range_uptodate()
f68e48b
iomap: protect read_bytes_pending with the state_lock
6894f96
mm: add folio_end_read()
efe1f38
ext4: use folio_end_read()
a5fd89b
buffer: use folio_end_read()
ed77f40
iomap: use folio_end_read()
409e640
bitops: add xor_unlock_is_negative_byte()
274dc49
alpha: implement xor_unlock_is_negative_byte
b04f8fd
m68k: implement xor_unlock_is_negative_byte
5576c83
mips: implement xor_unlock_is_negative_byte
daef225
powerpc: implement arch_xor_unlock_is_negative_byte on 32-bit
0efb534
riscv: implement xor_unlock_is_negative_byte
2006515
s390: implement arch_xor_unlock_is_negative_byte
5361dfc
mm: delete checks for xor_unlock_is_negative_byte()
1d8d227
mm: add folio_xor_flags_has_waiters()
b30a671
mm: make __end_folio_writeback() return void
b426260
mm: use folio_xor_flags_has_waiters() in folio_end_writeback()
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -73,7 +73,8 @@ int __mips_test_and_clear_bit(unsigned long nr, | |
| volatile unsigned long *addr); | ||
| int __mips_test_and_change_bit(unsigned long nr, | ||
| volatile unsigned long *addr); | ||
|
|
||
| bool __mips_xor_is_negative_byte(unsigned long mask, | ||
| volatile unsigned long *addr); | ||
|
|
||
| /* | ||
| * set_bit - Atomically set a bit in memory | ||
|
|
@@ -279,6 +280,28 @@ static inline int test_and_change_bit(unsigned long nr, | |
| return res; | ||
| } | ||
|
|
||
| static inline bool xor_unlock_is_negative_byte(unsigned long mask, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. issue (complexity): Consider factoring out the conditional and inline assembly duplication into a helper function to improve code reuse and readability. Consider factoring out the conditional and inline assembly duplication into a helper that picks the “mask” at a single point. For example:
```c
static inline unsigned long xor_unlock_atomic(volatile unsigned long *p,
unsigned long effective_mask)
{
unsigned long orig;
if (!kernel_uses_llsc)
orig = __mips_xor_is_negative_byte(effective_mask, p);
else
orig = __test_bit_op(*p, "%0", "xor\t%1, %0, %3", "ir"(effective_mask));
return orig;
}
static inline bool xor_unlock_is_negative_byte(unsigned long mask,
volatile unsigned long *p)
{
unsigned long eff_mask = kernel_uses_llsc ? BIT(7) : mask;
unsigned long orig;
smp_mb__before_atomic();
orig = xor_unlock_atomic(p, eff_mask);
smp_llsc_mb();
return (orig & eff_mask) != 0;
}This consolidates the conditional logic and reduces duplicate inline assembly while retaining original functionality. |
||
| volatile unsigned long *p) | ||
| { | ||
| unsigned long orig; | ||
| bool res; | ||
|
|
||
| smp_mb__before_atomic(); | ||
|
|
||
| if (!kernel_uses_llsc) { | ||
| res = __mips_xor_is_negative_byte(mask, p); | ||
| } else { | ||
| orig = __test_bit_op(*p, "%0", | ||
| "xor\t%1, %0, %3", | ||
| "ir"(mask)); | ||
| res = (orig & BIT(7)) != 0; | ||
| } | ||
|
|
||
| smp_llsc_mb(); | ||
|
|
||
| return res; | ||
| } | ||
|
|
||
| #undef __bit_op | ||
| #undef __test_bit_op | ||
|
|
||
|
|
||
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue (complexity): Consider using GNU atomic builtins to replace the inline assembly loop with a single atomic XOR operation, if the platform supports it, to reduce complexity and duplicate logic while preserving functionality .
Consider using the GNU atomic builtins to simplify the inline assembly loop. For example, if the platform supports __atomic builtins, you can replace the inline assembly with a single atomic XOR operation:
This preserves the functionality while reducing the low-level complexity and duplicate logic.