linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Timur Tabi <ttabi@interactivesi.com>
To: linux-mm@kvack.org
Subject: Re: order of matching alloc_pages/free_pages call pairs. Are they always same?
Date: Tue, 29 May 2001 11:24:14 -0500	[thread overview]
Message-ID: <f1ZeVC.A.A_H.v08E7@dinero.interactivesi.com> (raw)
In-Reply-To: <OF5385EE96.412D8BDB-ON85256A58.005E44E7@pok.ibm.com>

** Reply to message from "Bulent Abali" <abali@us.ibm.com> on Sat, 26 May 2001
13:10:42 -0400


> Is it reasonable to assume that matching
> alloc_pages/free_pages pairs will always have the same order
> as the 2nd argument?
> 
> For example
> pg = alloc_pages( , aorder);   free_pages(pg, forder);
> Is (aorder == forder) always true?
> 
> Or, are there any bizarro drivers etc which will intentionally
> free partial amounts, that is (forder < aorder)?

Yes!!  My driver does exactly that!!  Please DO NOT do anything to break this
functionality.  Here's the code which does that:

void fragment_and_free(void *_region, unsigned current_order, unsigned
new_order)
{
    unsigned long current_size = (1 << current_order) << PAGE_SHIFT;
    unsigned long new_size = (1 << new_order) << PAGE_SHIFT;

    char *region = (char *) _region;
    char *p;

    printk("Subdividing block of order %u into blocks of order %u\n",
current_order, new_order);

    if (new_order <= current_order)
    {
        for (p = region; p < (region + current_size); p += new_size)
            free_pages((u32) p, new_order);
    }
}


-- 
Timur Tabi - ttabi@interactivesi.com
Interactive Silicon - http://www.interactivesi.com

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/

      parent reply	other threads:[~2001-05-29 16:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-05-26 17:10 Bulent Abali
2001-05-27  3:12 ` Joseph A. Knapka
2001-05-29 16:24 ` Timur Tabi [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=f1ZeVC.A.A_H.v08E7@dinero.interactivesi.com \
    --to=ttabi@interactivesi.com \
    --cc=linux-mm@kvack.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