public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Chin Liang See <clsee@altera.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] malloc_simple: Add simple malloc free function
Date: Thu, 4 Aug 2016 23:12:54 +0800	[thread overview]
Message-ID: <1470323574.2136.8.camel@altera.com> (raw)
In-Reply-To: <d4f3bcca-e20d-cf84-64e5-a1ceae44ea62@denx.de>

On Thu, 2016-08-04 at 07:30 +0200, Marek Vasut wrote:
> On 08/03/2016 05:22 PM, Chin Liang See wrote:
> 
> Hi,

Hi Marek,

> 
> [...]
> > > > It's the fat driver which is utilizing the malloc.
> > > 
> > > So fat is allocating stuff without freeing it ? I wonder if we
> > > should
> > > either fix fat or use full malloc in SPL on A10 . I am not really
> > > fond
> > > of adding more stuff into simple malloc (to keep it small and 
> > > simple).
> > 
> > Actually fat driver is good where it invoke malloc and free during
> > the
> > operation. Just that with existing malloc, there is no free
> > implementation and memory keep "push" every time malloc invoked.
> 
> And I agree with Simon that we should look into the FAT driver and
> fix
> it. Is that not possible ?


Definitely as seems everyone believe this should be the right way to
go.

> 
> > > > > Your design breaks in the scenario where someone does big
> > > > > malloc
> > > > > followed by two small mallocs if I understand it correctly.
> > > > > This
> > > > > doesn't scale and is a hack.
> > > > > 
> > > > 
> > > > Actually the proposed free is a simple implementation which
> > > > acts as
> > > > stack push and pop with depth of 2. This is to enhance existing
> > > > implementation which don't handle the pop. This get worst
> > > > especially
> > > > dealing with fat driver.
> > > 
> > > Well, how does it handle my example? It doesn't and it fails to
> > > help
> > > in
> > > such case, right ?
> > 
> > I was thinking what is the correct depth while trying to keep
> > things
> > simple. From the FAT access testing with SD and eMMC, depth of 2
> > works
> > well by cutting lot of memory consumption by simple malloc
> > implementation. Any thoughts whether should have more flexibility?
> 
> You still didn't answer my question -- how will this handle my
> example
> usecase ?
> 

I did and wonder my email server having issue again. For this case,
yah, it will not being handle as we try to keep it simple by having
depth of 2. FYI, the 2 is being derived from my experiment of FAT
driver access with SD and eMMC devices. We can enhance that but
probably that might not a good idea per Simon suggested.

Thanks
Chin Liang

  reply	other threads:[~2016-08-04 15:12 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-03  3:24 [U-Boot] [PATCH] malloc_simple: Add simple malloc free function Chin Liang See
2016-08-03  6:58 ` Marek Vasut
2016-08-03  7:30   ` Chin Liang See
2016-08-03  7:53     ` Marek Vasut
2016-08-03 13:41       ` Chin Liang See
2016-08-03 13:57         ` Marek Vasut
2016-08-03 15:22           ` Chin Liang See
2016-08-04  5:30             ` Marek Vasut
2016-08-04 15:12               ` Chin Liang See [this message]
2016-08-04 15:26                 ` Marek Vasut
2016-08-04  1:17 ` Simon Glass
2016-08-04 15:09   ` Chin Liang See

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=1470323574.2136.8.camel@altera.com \
    --to=clsee@altera.com \
    --cc=u-boot@lists.denx.de \
    /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