Skip to content
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

kernel: Remove batchpriority from kernel library #30083

Merged
merged 1 commit into from May 14, 2024

Conversation

TheCharlatan
Copy link
Contributor

@TheCharlatan TheCharlatan commented May 10, 2024

The current usage of ScheduleBatchPriority is not transparent. Once the thread scheduling is changed, it remains unchanged for the remainder of the thread's lifetime. So move the call from ImportBlocks to the init code where it is clearer that its effect lasts for the entire lifetime of the thread.

Users of the kernel library might not expect ImportBlocks to have an influence on the thread it is called in. Particularly since it is only a compile time option and cannot be controlled at runtime. With this patch users of the kernel library can now freely choose their own scheduling policy.

This PR is easier reviewed with git diff --color-moved-ws=ignore-all-space --color-moved=dimmed-zebra


This PR is part of the libbitcoinkernel project.

@DrahtBot
Copy link
Contributor

DrahtBot commented May 10, 2024

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Code Coverage

For detailed information about the code coverage, see the test coverage report.

Reviews

See the guideline for information on the review process.

Type Reviewers
ACK maflcko, ryanofsky, hebasto

If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

@maflcko
Copy link
Member

maflcko commented May 13, 2024

utACK 04ffe40 🎪

Show signature

Signature:

untrusted comment: signature from minisign secret key on empty file; verify via: minisign -Vm "${path_to_any_empty_file}" -P RWTRmVTMeKV5noAMqVlsMugDDCyyTSbA3Re5AkUrhvLVln0tSaFWglOw -x "${path_to_this_whole_four_line_signature_blob}"
RUTRmVTMeKV5npGrKx1nqXCw5zeVHdtdYURB/KlyA/LMFgpNCs+SkW9a8N95d+U4AP1RJMi+krxU1A3Yux4bpwZNLvVBKy0wLgM=
trusted comment: utACK 04ffe4061da2d0135f206032e167703772b5da78 🎪
+qesV40tSRVM79Z50q9pkaw6EHghp2f2kaOTAqmPSZrbiwPdZpTUZ9LRm10oH73eRU6lRi7LFaZGDceW1rZzDg==

Copy link
Contributor

@ryanofsky ryanofsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review ACK 04ffe40, this is an obvious improvement

}
} // End scope of ImportingNow
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In commit "kernel: Remove batchpriority from kernel library" (04ffe40)

I think it might be useful to keep the // End scope of ImportNow comment here. If someone is adding new code at this point, it's possible they might want to add it with importing set to false, or importing set to true, so the comment would be a reminder that the value will change at this point.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you want to preserve the comment or the scoping? I was on the fence about this, but decided to drop the scoping after the introduced RAII wrappers for the ECC context, which don't scope either: https://github.com/bitcoin/bitcoin/pull/29252/files#diff-dbfadb3e0332664bff298a329b1d27065d2decbbe43fd391388af18f5861c114R17

Besides, I don't think it is likely that his function will grow. It is finally scoped in a reasonably limited way now. If a more functionality is added, it should probably go in another function and removing the scoping as done here encourages that.

Copy link
Contributor

@ryanofsky ryanofsky May 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

re: #30083 (comment)

Whatever you prefer is good. I like getting rid of the nested scope, and the current PR is fine. I was just suggesting keeping the comment as a reminder that the import variable would be change to false at that point.

@fanquake fanquake requested a review from theuni May 14, 2024 03:44
The current usage of ScheduleBatchPriority is not transparent. Once the
thread scheduling is changed, it remains unchanged for the remainder of
the thread's lifetime. So move the call from `ImportBlocks` to the init
code where it is clearer that its effect lasts for the entire lifetime
of the thread.

Users of the kernel library might not expect `ImportBlocks` to have an
influence on the thread it is called in. Particularly since it is only a
compile time option and cannot be controlled at runtime. With this patch
users of the kernel library can now choose their own scheduling policy.
@TheCharlatan
Copy link
Contributor Author

Thanks for the ACKs, should be trivial to re-ACK.

Updated 04ffe40 -> d4b17c7 (rmKernelBatchPriority_0 -> rmKernelBatchPriority_1, compare)

@maflcko
Copy link
Member

maflcko commented May 14, 2024

ACK d4b17c7 📭

Show signature

Signature:

untrusted comment: signature from minisign secret key on empty file; verify via: minisign -Vm "${path_to_any_empty_file}" -P RWTRmVTMeKV5noAMqVlsMugDDCyyTSbA3Re5AkUrhvLVln0tSaFWglOw -x "${path_to_this_whole_four_line_signature_blob}"
RUTRmVTMeKV5npGrKx1nqXCw5zeVHdtdYURB/KlyA/LMFgpNCs+SkW9a8N95d+U4AP1RJMi+krxU1A3Yux4bpwZNLvVBKy0wLgM=
trusted comment: ACK d4b17c7d46ad8e2833ade99d5b4c9741c913e84d 📭
suRJUCQ4uzxiXNUieIrA4SeUCJIloFdgg+YvgCi0vdTfSIQEnnKZRVj3kRUjiqOz8RbQwh+se0rOwSIUgZeKAg==

@DrahtBot DrahtBot requested a review from ryanofsky May 14, 2024 11:19
Copy link
Contributor

@ryanofsky ryanofsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review ACK d4b17c7, just added suggested comment since last review

@hebasto
Copy link
Member

hebasto commented May 14, 2024

Concept ACK.

Copy link
Member

@hebasto hebasto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK d4b17c7, I have reviewed the code and it looks OK.

@ryanofsky ryanofsky merged commit dbb3113 into bitcoin:master May 14, 2024
16 checks passed
@theuni
Copy link
Member

theuni commented May 14, 2024

Post-merge utACK d4b17c7

@hebasto
Copy link
Member

hebasto commented May 20, 2024

Ported to the CMake-based build system in hebasto#202.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done or Closed or Rethinking
Development

Successfully merging this pull request may close these issues.

None yet

6 participants