Re: [PATCH v2 1/2] sched/wait: Add wait_threshold

From: Pavel Begunkov
Date: Tue Sep 24 2019 - 02:44:38 EST



On 23/09/2019 22:27, Peter Zijlstra wrote:
>
> A: Because it messes up the order in which people normally read text.
> Q: Why is top-posting such a bad thing?
> A: Top-posting.
> Q: What is the most annoying thing in e-mail?
>
> On Mon, Sep 23, 2019 at 07:37:46PM +0300, Pavel Begunkov wrote:
>> Just in case duplicating a mail from the cover-letter thread:
>
> Just because every patch should have a self contained and coherent
> Changelog.

Well, I will expand the patch description, if we agree on the
implementation (at least conceptually).


>>
>> BTW, this monster is mostly a copy-paste from wait_event_*(),
>> wait_bit_*(). We could try to extract some common parts from these
>> three, but that's another topic.
>
> I don't think that is another topic at all. It is a quality of
> implementation issue. We already have too many copies of all that (3).

For example, ___wait_event() is copied in ___wait_var_event(). Instead
it could accept a wait entry generator or just accept entry from above
and be reused in both cases. I've had such a patch, but want to think
what else could be done.

e.g.
```
#define generic_wait_event(ENTRY_GEN, ...)
ENTRY_GEN(wq_entry_name);
do_wait_event(wq_entry_name);

#define WBQ_ENTRY_GEN(name)
struct wait_bit_queue_entry tmp = WBQ_INITIALIZER;
struct wait_queue_entry name = &tmp->wq_entry;
```


>
> So basically you want to fudge the wake function to do the/a @cond test,
> not unlike what wait_bit already does, but differenly.
>
Yes

> I'm really rather annoyed with C for not having proper lambda functions;
> that would make all this so much easier. Anyway, let me have a poke at
> this in the morning, it's late already.
>
> Also, is anything actually using wait_queue_entry::private ? I'm
> not finding any in a hurry.
>
>

--
Yours sincerely,
Pavel Begunkov

Attachment: signature.asc
Description: OpenPGP digital signature