From: Matt Porter <porter@cox.net>
To: linux-kernel@vger.kernel.org
Subject: [PATCH][2.4] update ref counts on all allocated pages
Date: Tue, 26 Nov 2002 17:07:23 -0700 [thread overview]
Message-ID: <20021126170723.A23962@home.com> (raw)
The following patch sets the ref count on all pages of an
allocation. This allows an allocation with order>0 to be freed
via individual __free_page() calls within vfree().
This is important on non cache coherent processors which
have a pci_alloc_consistent/consistent_alloc() implementation
that involves creating a vmalloc area cache inhibited mapping
of allocated pages.
Because of this implementation, the implementation
of pci_free_consistent/consistent_free is done via
a vfree(). Without this patch only the first page
of the allocated memory is freed since successive pages
all have ref counts of zero.
-Matt
===== mm/page_alloc.c 1.56 vs edited =====
--- 1.56/mm/page_alloc.c Tue Aug 20 04:39:48 2002
+++ edited/mm/page_alloc.c Tue Nov 26 12:03:38 2002
@@ -203,6 +203,7 @@
struct list_head *head, *curr;
unsigned long flags;
struct page *page;
+ int i;
spin_lock_irqsave(&zone->lock, flags);
do {
@@ -224,7 +225,10 @@
page = expand(zone, page, index, order, curr_order, area);
spin_unlock_irqrestore(&zone->lock, flags);
- set_page_count(page, 1);
+ /* Set ref count on all pages */
+ for (i = 0; i < (1 << order); i++)
+ set_page_count(page+i, 1);
+
if (BAD_RANGE(zone,page))
BUG();
if (PageLRU(page))
--
Matt Porter
porter@cox.net
This is Linux Country. On a quiet night, you can hear Windows reboot.
--
Matt Porter
porter@cox.net
This is Linux Country. On a quiet night, you can hear Windows reboot.
next reply other threads:[~2002-11-26 23:29 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-11-27 0:07 Matt Porter [this message]
2002-11-27 10:31 ` David S. Miller
2002-11-27 15:25 ` Matt Porter
2002-11-28 3:33 ` David S. Miller
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=20021126170723.A23962@home.com \
--to=porter@cox.net \
--cc=linux-kernel@vger.kernel.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
all inboxes | Powered by JetHome®