linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Todd Poynor <tpoynor@mvista.com>
To: David Gibson <david@gibson.dropbear.id.au>
Cc: linuxppc-dev <linuxppc-dev@lists.linuxppc.org>
Subject: Re: consistent_free re-revisited
Date: Thu, 12 Sep 2002 14:33:24 -0700	[thread overview]
Message-ID: <3D810824.9020004@mvista.com> (raw)
In-Reply-To: 20020912032640.GA32156@zax


David Gibson wrote:

>>Furthermore, consistent_alloc does not fill out vm_struct fields for the
>>VM area that map it to the struct pages, so consistent_free can't use
>>those to derive the physical pages.  And neither can vfree(), which is
>>what consistent_free() calls to do its work.  And so consistent_free()
>>does not free the physical pages allocated by consistent_alloc()...
>
> Erm... vfree() walks the page tables to find the pages to free, which
> should work fine.

Been curious about this... vfree() walks the page tables to find PTE
entries to unmap (modifying the PTE entry).  But its code to call
__free_page() on the physical pages for the area (the deallocate_pages
condition in __vunmap()) is not being executed (because area->nr_pages
== 0), and it seems likely this is needed.

After modifying consistent_alloc() to fill out the area->pages array and
set area->nr_pages, __vunmap() will then call __free_page() on those
pages.  Whereupon:

   vaddr = consistent_alloc(gfp, size, &physaddr);
   consistent_free(vaddr);
   vaddr = consistent_alloc(gfp, size, &physaddr);

then allocates the same physaddr both times, which is not currently the
case.  There is also an overall difference in memory usage in the
neighborhood of the allocated buffer size between the 2 schemes (per
free(1) at a shell prompt), but I wouldn't swear to it...


--
Todd


** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

      parent reply	other threads:[~2002-09-12 21:33 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-09-11 21:45 consistent_free re-revisited Todd Poynor
2002-09-12  3:26 ` David Gibson
2002-09-12 14:29   ` Tom Rini
2002-09-12  7:23     ` Benjamin Herrenschmidt
2002-09-12 14:51       ` Tom Rini
2002-09-12  7:49         ` Benjamin Herrenschmidt
2002-09-12 15:23           ` Tom Rini
2002-09-12  8:08             ` Benjamin Herrenschmidt
2002-09-12 17:05     ` Matt Porter
2002-09-12 21:33   ` Todd Poynor [this message]

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=3D810824.9020004@mvista.com \
    --to=tpoynor@mvista.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=linuxppc-dev@lists.linuxppc.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;
as well as URLs for NNTP newsgroup(s).