From: David Howells <dhowells@redhat.com>
To: Tejun Heo <tj@kernel.org>, Lai Jiangshan <jiangshanlai@gmail.com>
Cc: dhowells@redhat.com, Peter Zijlstra <peterz@infradead.org>,
linux-kernel@vger.kernel.org
Subject: Can we get a general timed LRU built on the workqueue subsys?
Date: Tue, 08 Jun 2021 16:14:21 +0100 [thread overview]
Message-ID: <485281.1623165261@warthog.procyon.org.uk> (raw)
Hi Tejun,
Would it be practical to get some sort of timed LRU built on top of the
workqueue such that I can, say, queue an item on it without using the
delayed_work struct?
The reason I'd like this is that I want to avoid using delayed_work because it
would increase the size of the fscache_cookie struct by 50% (110% with
lockdep), and then you'd have to multiply that by the number of cookies on the
system - could be tens or hundreds of thousands; could be a million+ in some
applications.
Really, only one timer should be necessary for the entire queue if every item
in the queue has the same timeout length, since it would only need to keep
track of the item at the front of the queue. This timer could be managed with
timer_reduce() rather than mod_timer() or del_timer()+add_timer().
Each item in the queue would need a timestamp to say when it expires, say:
struct work_lru {
struct work_struct work;
unsigned long expires_at;
};
There are other places I could use such a thing too, not just for fscache
cookies.
David
next reply other threads:[~2021-06-08 15:15 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-08 15:14 David Howells [this message]
2021-06-16 15:50 ` Can we get a general timed LRU built on the workqueue subsys? Tejun Heo
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=485281.1623165261@warthog.procyon.org.uk \
--to=dhowells@redhat.com \
--cc=jiangshanlai@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=tj@kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox