mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ingo Oeser <ingo.oeser@informatik.tu-chemnitz.de>
To: Rik van Riel <riel@conectiva.com.br>
Cc: "Richard B. Johnson" <root@chaos.analogic.com>,
	Linux kernel <linux-kernel@vger.kernel.org>,
	linux-mm@kvack.org
Subject: Re: kmalloc() allocation.
Date: Tue, 31 Oct 2000 16:17:53 +0100	[thread overview]
Message-ID: <20001031161753.F7204@nightmaster.csn.tu-chemnitz.de> (raw)
In-Reply-To: <20001031114851.D7204@nightmaster.csn.tu-chemnitz.de> <Pine.LNX.4.21.0010311134590.23139-100000@duckman.distro.conectiva>
In-Reply-To: <Pine.LNX.4.21.0010311134590.23139-100000@duckman.distro.conectiva>; from riel@conectiva.com.br on Tue, Oct 31, 2000 at 11:35:46AM -0200

On Tue, Oct 31, 2000 at 11:35:46AM -0200, Rik van Riel wrote:
> > Rik: What do you think about this (physical cont. area cache) for 2.5?
                                       ^^^^^^^^^^^^^^^^^^^^^^^^^ == PCAC
> 
> http://www.surriel.com/zone-alloc.html

Read it when you published it first, but didn't notice you still
worked on it ;-)

My approach is still different. We get the HINT for free. And
your zone only shift this problem from page to mem_zone level.

I thought about sth. like this:

/* Adds an physical continuous area of pages to the PCAC.
 * To be implemented later, once we decide on a data structure
 * for this, which can do fast unique insert and at least O(N)
 * retrieve. (Hashes?)
 */
void add_phys_cont_chunk(struct phys_page *start, size_t area_size);

/* Add page(s) to pool, where we prefer to kmalloc() small things
 * and vmalloc() things. This gets us close to a best fit
 * strategy instead of sth. like the first fit we have now.
 */
void add_small_phys_area(struct phys_page *start, size_t area_size);

/* Gets a chunk of at least area_size pages and removes it from
 * the PCAC or NULL of none found.
 *
 * To be implemented later along with the above routine.
 */
struct phys_page *get_phys_cont_chunk(size_t area_size);

#define suitable(p) (moveable(p) || freeable(p)) /* refine this */
#define MIN_PHYS_CHUNK 2 /* tune this */

/* in physical page scan to transfer REFERENCED bit */

   size_t area_size = 0;
   struct phys_page *p, *chunk_start;

   p = prev = first_phys_page;

   while (p != last_phys_page) {
      if (area_size) {
         if (suitable(p)) { 
         
            /* expand recent chunk */
            area_size++;

         } else {
         
            /* insert last chunk */
            if (area_size >= MIN_PHYS_CHUNK) 
               add_phys_cont_chunk(chunk_start, area_size);
            else add_small_phys_area(chunk_start, area_size);
            area_size = 0;
         }
      } else {
         if (suitable(p)) {

            /* start new chunk */
            area_size = 1;
            chunk_start = p;
         }
      }
      p = p->next;
   }

And later, when we need a physically continuous area >= MIN_PHYS_CHUNK:

   /* lookup PCAC for a hint */
   struct phys_page *s = get_phys_cont_chunk(area_size);
   
   if (s) {
      size_t a = area_size;
      struct phys_page *p = s;
      
      /* lock down page tables */
      while (a--) {
         if ( ! free_or_move_page(p) )
            break;
         p = p->next;
      }
      /* unlock page tables*/
      if (!a) 
         return s; /* hey, it worked! */

   } else {
      /* no hints, try it the old way or fail */
   }


Hope it sound not too stupid ;-)

Regards 

Ingo Oeser
-- 
Feel the power of the penguin - run linux@your.pc
<esc>:x
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

  parent reply	other threads:[~2000-10-31 15:18 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-10-30 15:57 Richard B. Johnson
2000-10-30 16:06 ` Tigran Aivazian
2000-10-30 16:28   ` Richard B. Johnson
2000-10-30 16:38     ` Tigran Aivazian
2000-10-30 17:57       ` Richard B. Johnson
2000-10-30 16:06 ` John Levon
2000-10-30 16:27   ` Richard B. Johnson
2000-10-30 16:49     ` Jeff Garzik
2000-10-30 16:54       ` Tigran Aivazian
2000-10-30 17:08         ` Jeff Garzik
2000-10-30 18:08           ` Richard B. Johnson
2000-10-30 18:06       ` Richard B. Johnson
2000-10-30 18:10         ` Jeff Garzik
2000-10-30 16:40 ` Rik van Riel
2000-10-31  7:03   ` Mike Galbraith
2000-10-31 10:48   ` Ingo Oeser
2000-10-31 13:35     ` Rik van Riel
2000-10-31 13:59       ` Richard B. Johnson
2000-10-31 15:57         ` Pauline Middelink
2000-10-31 15:17       ` Ingo Oeser [this message]
2000-10-31 16:11         ` Rik van Riel
2000-10-31 18:22           ` Ingo Oeser
2000-10-31 14:43     ` afei
2000-10-30 18:22 ` Alan Cox
2000-10-30 18:37   ` Richard B. Johnson
2000-10-31  5:28     ` H. Peter Anvin
2000-10-31  6:11       ` Brian Gerst
2000-10-31  8:44         ` Andi Kleen
2000-10-31 12:58           ` Brian Gerst
2000-10-31 14:48             ` kernel
2000-10-31 15:01               ` Alan Cox
2000-10-31 15:57                 ` kernel
2000-10-31  8:49         ` Tigran Aivazian
2000-10-31  8:54           ` Andi Kleen
2000-10-31  9:07             ` Tigran Aivazian
2000-10-31  9:25               ` Andi Kleen

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=20001031161753.F7204@nightmaster.csn.tu-chemnitz.de \
    --to=ingo.oeser@informatik.tu-chemnitz.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=riel@conectiva.com.br \
    --cc=root@chaos.analogic.com \
    /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®