From: Denis Kenzior <denkenz@gmail.com>
To: ofono@ofono.org
Subject: Re: [PATCH] PPP: Optimize write buffer management
Date: Wed, 02 Mar 2011 09:28:09 -0600 [thread overview]
Message-ID: <4D6E6209.6030908@gmail.com> (raw)
In-Reply-To: <1299055349.1964.25.camel@pporlan-linux>
[-- Attachment #1: Type: text/plain, Size: 2139 bytes --]
Hi Patrick,
>> Is there a particular reason why you chose to use a ring buffer of ring
>> buffers? A simple GQueue might be much easier to understand. If you are
>> worried about 'infinite queuing' then a simple counter might help to
>> alleviate that.
>
> Well, this implementation opens the door to further optimizations, such
> as reusing cells (buffers) to avoid frequent allocation/deallocation.
>
I think I know where you're going with this, but I'm unconvinced the
circular buffer of buffers is buying you anything over the much simpler
to understand queue of buffers approach.
>
>> You change BUFFER_SIZE from 2048 to 4096 and remove the multiplication
>> here. It is a good idea to send these types of changes in a separate
>> patch for two reasons:
>> - Logically they should be separate
>> - It is much easier to review for correctness outside the context of a
>> large patch
>
> Got it. By the way, why is it written this way? Is it to stress that we
> want space for two frames?
>
You'd have to ask Marcel, but yes I think this was the intent.
>> So I think we have to be a bit careful here. HDLC framing can in theory
>> (if you're maximally unlucky) result in doubling of the data size once
>> it is framed. This means that we might have enough space in the current
>> buffer according to this estimate, but still exceed it once the actual
>> framing is performed. If so, then we have to drop the frame.
>>
>> There are two possibilities:
>> - Retry again with a full buffer this time
>> - Always pick a buffer if we have less than 2x size available
>>
>
> Thanks for the insight. Picking a new buffer may be best. That will
> cause more buffer "run away" though, strengthening the case for better
> buffer recycling strategies.
>
Yes, we definitely want to have some sort of buffer pool management
strategy to share a pool of buffers between different entities (e.g.
GAtMux, GAtServer, GAtHDLC). Have you looked at g_slice* inside glib
yet? I think we can take advantage of the fact that most of our ring
buffers are sized at 4k.
Regards,
-Denis
next prev parent reply other threads:[~2011-03-02 15:28 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-01 15:07 [PATCH] PPP: Optimize write buffer management Patrick Porlan
2011-03-02 3:47 ` Denis Kenzior
2011-03-02 8:42 ` Patrick Porlan
2011-03-02 9:59 ` patch to fix BMC #13679 Huawei EM770: ofonod crash when disable/enable 3G technology Xu, Martin
2011-03-03 5:22 ` Denis Kenzior
2011-03-04 6:53 ` Xu, Martin
2011-03-04 15:19 ` Denis Kenzior
2011-03-02 15:28 ` Denis Kenzior [this message]
2011-03-08 16:08 ` [PATCH] PPP: Optimize write buffer management Patrick Porlan
-- strict thread matches above, loose matches on Subject: below --
2011-03-08 15:58 Patrick Porlan
2011-03-15 19:28 ` Denis Kenzior
2011-03-16 9:00 ` Patrick Porlan
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=4D6E6209.6030908@gmail.com \
--to=denkenz@gmail.com \
--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.