From: Petr Machata <petrm@nvidia.com>
To: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Cc: Jakub Kicinski <kuba@kernel.org>, <netdev@vger.kernel.org>,
<edumazet@google.com>, <pabeni@redhat.com>,
<willemdebruijn.kernel@gmail.com>, <leitao@debian.org>,
<petrm@nvidia.com>, <davem@davemloft.net>
Subject: Re: [RFC net-next 1/2] selftests: drv-net: add ability to schedule cleanup with defer()
Date: Wed, 26 Jun 2024 11:19:08 +0200 [thread overview]
Message-ID: <87tthg9hvv.fsf@nvidia.com> (raw)
In-Reply-To: <d7a8b57d-0dea-4160-8aa3-24e18cf2490e@intel.com>
Przemek Kitszel <przemyslaw.kitszel@intel.com> writes:
> On 6/26/24 03:36, Jakub Kicinski wrote:
>
>> There is a global action queue, flushed by ksft_run(). We could support
>> function level defers too, I guess, but there's no immediate need..
>
> That would be a must have for general solution, would it require some
> boilerplate code at function level?
Presumably you'd need a per-function defer pool.
Which would be naturally modeled as a context manager, but I promised
myself I'd shut up about that.
>> + def __enter__(self):
>> + return self
>> +
>> + def __exit__(self, ex_type, ex_value, ex_tb):
>> + return self.exec()
>
> why do you need __enter__ and __exit__ if this is not a context
> manager / to-be-used-via-with?
But you could use it as a context manager.
with defer(blah blah):
do stuff
# blah blah runs here
IMHO makes sense.
next prev parent reply other threads:[~2024-06-26 9:24 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-26 1:36 [RFC net-next 0/2] selftests: drv-net: add ability to schedule cleanup with defer() Jakub Kicinski
2024-06-26 1:36 ` [RFC net-next 1/2] " Jakub Kicinski
2024-06-26 7:43 ` Przemek Kitszel
2024-06-26 9:19 ` Petr Machata [this message]
2024-06-26 9:38 ` Przemek Kitszel
2024-06-26 16:44 ` Jakub Kicinski
2024-06-26 16:49 ` Jakub Kicinski
2024-06-27 8:40 ` Przemek Kitszel
2024-06-27 15:35 ` Jakub Kicinski
2024-06-26 10:18 ` Petr Machata
2024-06-26 16:09 ` Jakub Kicinski
2024-06-27 7:37 ` Petr Machata
2024-06-27 15:41 ` Jakub Kicinski
2024-06-26 1:36 ` [RFC net-next 2/2] selftests: drv-net: rss_ctx: convert to defer() Jakub Kicinski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87tthg9hvv.fsf@nvidia.com \
--to=petrm@nvidia.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=leitao@debian.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=przemyslaw.kitszel@intel.com \
--cc=willemdebruijn.kernel@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.