From: Andrew Morton <akpm@zip.com.au>
To: lkml <linux-kernel@vger.kernel.org>
Subject: aa-120-try_to_free_pages_nozone
Date: Tue, 19 Mar 2002 19:59:35 -0800 [thread overview]
Message-ID: <3C980927.8D46B620@zip.com.au> (raw)
The page reclaiming logic operates on a per-zone basis. This patch
introduces a general try_to_free_pages_nozone() which just tries to
free 32 pages from *every* zone.
This function is only used from free_more_memory() in fs/buffer.c.
When we're trying to grow buffers against a device for filesystem
metadata.
It seems to me that free_more_memory() simply is not needed - we're
already retrying the allocation over in buffer.c, and it seems that
this will do most everything which the call to try_to_free_pages()
would do?
=====================================
--- 2.4.19-pre3/fs/buffer.c~aa-120-try_to_free_pages_nozone Tue Mar 19 19:49:01 2002
+++ 2.4.19-pre3-akpm/fs/buffer.c Tue Mar 19 19:49:01 2002
@@ -731,12 +731,8 @@ void __invalidate_buffers(kdev_t dev, in
static void free_more_memory(void)
{
- zone_t * zone = contig_page_data.node_zonelists[GFP_NOFS & GFP_ZONEMASK].zones[0];
-
- balance_dirty();
wakeup_bdflush();
- try_to_free_pages(zone, GFP_NOFS, 0);
- run_task_queue(&tq_disk);
+ try_to_free_pages_nozone(GFP_NOIO);
current->policy |= SCHED_YIELD;
__set_current_state(TASK_RUNNING);
schedule();
--- 2.4.19-pre3/include/linux/swap.h~aa-120-try_to_free_pages_nozone Tue Mar 19 19:49:01 2002
+++ 2.4.19-pre3-akpm/include/linux/swap.h Tue Mar 19 19:49:01 2002
@@ -113,6 +113,7 @@ extern void swap_setup(void);
extern wait_queue_head_t kswapd_wait;
extern int FASTCALL(try_to_free_pages(zone_t *, unsigned int, unsigned int));
extern int vm_vfs_scan_ratio, vm_cache_scan_ratio, vm_lru_balance_ratio, vm_passes, vm_gfp_debug, vm_mapped_ratio;
+extern int FASTCALL(try_to_free_pages_nozone(unsigned int));
/* linux/mm/page_io.c */
extern void rw_swap_page(int, struct page *);
--- 2.4.19-pre3/mm/page_alloc.c~aa-120-try_to_free_pages_nozone Tue Mar 19 19:49:01 2002
+++ 2.4.19-pre3-akpm/mm/page_alloc.c Tue Mar 19 19:49:13 2002
@@ -510,6 +510,30 @@ unsigned int nr_free_highpages (void)
}
#endif
+int try_to_free_pages_nozone(unsigned int gfp_mask)
+{
+ pg_data_t *pgdat = pgdat_list;
+ zonelist_t *zonelist;
+ zone_t **zonep;
+ int ret = 0;
+ unsigned long pf_free_pages;
+
+ pf_free_pages = current->flags & PF_FREE_PAGES;
+ current->flags &= ~PF_FREE_PAGES;
+
+ do {
+ zonelist = pgdat->node_zonelists + (gfp_mask & GFP_ZONEMASK);
+ zonep = zonelist->zones;
+
+ ret |= try_to_free_pages(*zonep, gfp_mask, 0);
+
+ pgdat = pgdat->node_next;
+ } while (pgdat);
+
+ current->flags |= pf_free_pages;
+ return ret;
+}
+
#define K(x) ((x) << (PAGE_SHIFT-10))
/*
-
reply other threads:[~2002-03-20 4:02 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=3C980927.8D46B620@zip.com.au \
--to=akpm@zip.com.au \
--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 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.