On Mon, Mar 11 2024 at 13:51, Ankur Arora wrote: > Joel Fernandes <joel@xxxxxxxxxxxxxxxxx> writes: >>> Why not key off of the value of CONFIG_PREEMPT_DYNAMIC? That way, >>> if both CONFIG_PREEMPT_AUTO=y and CONFIG_PREEMPT_DYNAMIC=y, RCU is >>> always preemptible. Then CONFIG_PREEMPT_DYNAMIC=y enables boot-time >>> (and maybe even run-time) switching between preemption flavors, while >>> CONFIG_PREEMPT_AUTO instead enables unconditional preemption of any >>> region of code that has not explicitly disabled preemption (or irq or >>> bh or whatever). > > Currently CONFIG_PREEMPT_DYNAMIC does a few things: > > 1. dynamic selection of preemption model > 2. dynamically toggling explicit preemption points > 3. PREEMPT_RCU=y (though maybe this should be fixed to also > also allow PREEMPT_RCU=n) > > Of these 3, PREEMPT_AUTO only really needs (1). > > Maybe combining gives us the option of switching between the old and the > new models: > preempt=none | voluntary | full | auto-none | auto-voluntary > > Where the last two provide the new auto semantics. But, the mixture > seems too rich. > This just complicates all the CONFIG_PREEMPT_* configurations more than > they were before when the end goal is to actually reduce and simplify > the number of options. > >> That could be done. But currently, these patches disable DYNAMIC if AUTO is >> enabled in the config. I think the reason is the 2 features are incompatible. >> i.e. DYNAMIC wants to override the preemption mode at boot time, where as AUTO >> wants the scheduler to have a say in it using the need-resched LAZY bit. > > Yeah exactly. That's why I originally made PREEMPT_AUTO and > PREEMPT_DYNAMIC exclusive of each other. Rightfully so. The purpose of PREEMPT_AUTO is to get rid of PREEMPT_DYNAMIC and not to proliferate the existance of it. There is no point. All what AUTO wants to provide at configuration time is the default model. So what would DYNAMIC buy what AUTO does not provide trivially with a single sysfs knob which only affects the scheduler where the decisions are made and nothing else? The only extra config knob is PREEMPT_RCU which as we concluded long ago needs to support both no and yes when AUTO is selected up to the point where that model can be switched at boot time too. Seriously, keep this stuff simple and straight forward and keep the real goals in focus: 1) Simplify the preemption model zoo 2) Get rid of the ill defined cond_resched()/might_sleep() hackery All the extra - pardon my french - ivory tower wankery on top is not helpful at all. We can debate this forever on a theoretical base and never get anywhere and anything done. Please focus on getting the base mechanics in place with the required fixes for the fallout for preemptible and non-preemtible RCU (selected at compile time) and work it out from there. Perfect it the enemy of good. Especially when nobody can come up with a perfect definition what 'perfect' actually means. Thanks, tglx