From: Sakari Ailus <sakari.ailus@maxwell.research.nokia.com>
To: Hans Verkuil <hverkuil@xs4all.nl>
Cc: linux-media@vger.kernel.org, laurent.pinchart@ideasonboard.com,
iivanov@mm-sol.com, gururaj.nagendra@intel.com
Subject: Re: [RFC v2 4/7] V4L: Events: Add backend
Date: Fri, 22 Jan 2010 19:10:49 +0200 [thread overview]
Message-ID: <4B59DC19.1050400@maxwell.research.nokia.com> (raw)
In-Reply-To: <alpine.LNX.2.01.1001181333040.31857@alastor>
Hans Verkuil wrote:
> Hi Sakari,
Hi, Hans!
> The code looks good, but I'm not so sure about the use of kmem_cache_*. It
> seems serious overkill to me.
>
> Most of the time there will only be a handful of event messages pending. So
> setting up a kmem_cache for this seems unnecessary to me.
>
> A much better way to ensure fast event reporting IMHO would be to keep a
> list
> of empty event messages rather than destroying an event after it is
> dequeued.
>
> So you have two queues per filehandle: pending and empty; initially both
> are
> empty. When a new event has to be queued the code checks if there are
> events
> available for reuse in the empty queue, and if not a new event struct is
> allocated and added to the pending queue.
I actually had this kind of setup there for a while. Then I thought it'd
be too ugly and went for kmem_cache instead.
The other reason is that it's convenient to keep the memory allocated
even if there are no events subscribed or the device isn't open. For
1000 events that's 96 kiB. I guess an unused kmem_cache object consumes
extra memory very little. The cached slabs can be explicitly freed
anyway by the driver.
The size of the kmem_cache also adjusts based on the number of events in
the queue. Allocating kmem_cache objects is fast if they already exist,
too. There can be temporary delays from allocation, of course.
I can bring it back, sure, if you see a fixed allocation better.
--
Sakari Ailus
sakari.ailus@maxwell.research.nokia.com
next prev parent reply other threads:[~2010-01-22 17:10 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-22 16:42 [RFC v2 0/7] V4L2 file handles and event interface Sakari Ailus
2009-12-22 16:43 ` [RFC v2 1/7] V4L: File handles Sakari Ailus
2009-12-22 16:43 ` [RFC v2 2/7] V4L: Events: Add new ioctls for events Sakari Ailus
2009-12-22 16:43 ` [RFC v2 3/7] V4L: Events: Support event handling in do_ioctl Sakari Ailus
2009-12-22 16:43 ` [RFC v2 4/7] V4L: Events: Add backend Sakari Ailus
2009-12-22 16:43 ` [RFC v2 5/7] V4L: Events: Limit event queue length Sakari Ailus
2009-12-22 16:43 ` [RFC v2 6/7] V4L: Events: Sequence numbers Sakari Ailus
2009-12-22 16:43 ` [RFC v2 7/7] V4L: Events: Support all events Sakari Ailus
2010-01-18 12:48 ` [RFC v2 6/7] V4L: Events: Sequence numbers Hans Verkuil
2010-01-18 12:58 ` [RFC v2 5/7] V4L: Events: Limit event queue length Hans Verkuil
2010-01-19 8:11 ` Laurent Pinchart
2010-01-19 9:03 ` Hans Verkuil
2010-01-24 13:06 ` Sakari Ailus
2009-12-23 1:01 ` [RFC v2 4/7] V4L: Events: Add backend Andy Walls
2009-12-23 10:15 ` Sakari Ailus
2010-01-18 12:43 ` Hans Verkuil
2010-01-22 17:10 ` Sakari Ailus [this message]
2010-01-18 12:32 ` [RFC v2 1/7] V4L: File handles Hans Verkuil
2010-01-22 16:43 ` Sakari Ailus
2010-01-18 13:07 ` [RFC v2 0/7] V4L2 file handles and event interface Hans Verkuil
2010-01-19 8:23 ` Laurent Pinchart
2010-01-19 9:06 ` Hans Verkuil
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=4B59DC19.1050400@maxwell.research.nokia.com \
--to=sakari.ailus@maxwell.research.nokia.com \
--cc=gururaj.nagendra@intel.com \
--cc=hverkuil@xs4all.nl \
--cc=iivanov@mm-sol.com \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-media@vger.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