All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marcel Holtmann <marcel@holtmann.org>
To: ofono@ofono.org
Subject: RE: Description of Voice call history plugin patch
Date: Fri, 17 Sep 2010 17:07:09 +0900	[thread overview]
Message-ID: <1284710829.2405.183.camel@localhost.localdomain> (raw)
In-Reply-To: <E1A1564674E5754FB00AB9AC949D5E3260C826D076@rrsmsx501.amr.corp.intel.com>

[-- Attachment #1: Type: text/plain, Size: 2026 bytes --]

Hi Raji,

> > Design : Plugin uses memory mapped file for high performance input/output operations. File is used as cyclic queue for storing or reading records, it store s 50 records of 78bytes,hence fixed size file of 3916 bytes is used. File's first 16 bytes were used for storing header, and next 3900 bytes for data. Header structure has head pointer, tail pointer,unread and lastid. Head pointer points to next slot for writing record into,tail for reading record, unread for number of history records unread by client, lastid for id of the last record that is written.
> 
> Just a couple quick points.  Memory mapped files do not really give any
> benefit over read/write/lseek for small files (e.g. less than a few
> pages) with small record sizes (e.g. less than a 4K page.)  In fact
> they're probably slower in these cases.
> 
> > Locking: 
> > Accessing Memory mapped file pointer , all header fields (head,tail,unread,lastid), temp_unread,temp_tail are synchronized by a mutex. writing into memory file and reading from memory file happen asynchronously, so mutex is used to protect the memory mapped file pointer , header, temp_unread, temp_tail.
> 
> I'm totally confused by this one; you use no threads in your plugin (and
> neither does oFono) and you have no external clients accessing the same
> shared memory region.  It seems to me that locking is completely
> unnecessary.
> 
> Raji > History reads are client driven, can happen during the write operation. Same with writing, if there is any read operation in progress, write operation needs to wait. So the mutex will lock the memory information until read/write operation is done. 

who reads from this file. The mutex is local to ofonod. If any other
program reads from that memory you need a proper memory lock. The local
mutex is not helping since ofonod is (on purpose) single threaded and
thus no locking is actually needed since read and write operations from
ofonod can't happen at the same time.

Regards

Marcel



  reply	other threads:[~2010-09-17  8:07 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-17  0:13 Description of Voice call history plugin patch Rajyalakshmi Bommaraju
2010-09-17  0:13 ` [PATCH] plugins: Adding implementation for persisting voice call history Rajyalakshmi Bommaraju
2010-09-17  1:14   ` Marcel Holtmann
2010-09-17  3:17 ` Description of Voice call history plugin patch Denis Kenzior
2010-09-17  6:32   ` Bommaraju, Rajyalakshmi
2010-09-17  8:07     ` Marcel Holtmann [this message]
2010-09-17  8:16 ` Marcel Holtmann
2010-09-17 18:00   ` Bommaraju, Rajyalakshmi
2010-09-17 23:41     ` Marcel Holtmann
2010-09-20 18:52   ` Bommaraju, Rajyalakshmi
2010-09-21  2:37     ` Marcel Holtmann

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=1284710829.2405.183.camel@localhost.localdomain \
    --to=marcel@holtmann.org \
    --cc=ofono@ofono.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 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.