All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hiroyuki KAMEZAWA <kamezawa.hiroyu@jp.fujitsu.com>
To: Hiroyuki KAMEZAWA <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Linux Kernel ML <linux-kernel@vger.kernel.org>,
	linux-mm <linux-mm@kvack.org>,
	LHMS <lhms-devel@lists.sourceforge.net>
Subject: Re: [Lhms-devel] [RFC] buddy allocator without bitmap(3) [1/3]
Date: Fri, 03 Sep 2004 08:54:31 +0900	[thread overview]
Message-ID: <4137B2B7.8080109@jp.fujitsu.com> (raw)
In-Reply-To: <4136D318.9060102@jp.fujitsu.com>


> New function: calculate_aligned_end()
> 
> calculate_aligned_end() removes some pages from system for removing invalid
> mem_map access from __free_pages_bulk() main loop.(This is in 4th patch)
> 
This is an illustration of the effects of calculate_aligned_end().

Examples for MAX_ORDER=4 is here.
In this case, an alignment of memmap is (1 << (4-1))=8

[unaligned end address case]

Consider contiguous mem_map from index 0 to index 19.
mem_map[16-19] is unaligned.

pfn     0           4           8          12            16 17 18 19
         -------------------------------------------------------------
order 0 |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  -- out of range --
         -------------------------------------------------------------
order 1 |     |     |     |     |     |     |     |     |     |     |
         -------------------------------------------------------------
order 2 |           |           |           |           |           |
         ------------------------------------------------------------
order 3 |                       |                       |
         -------------------------------------------------
         <----------------------> <---------------------> <---------??? ---->
In this case, invalid mem_map access will occur during

(1) coalescing page 16 with page 20 in order=2. <- this means memory access to page 20.

calculate_aligned_end() removes page 19.

  pfn     0           4           8          12            16 17 18 19
         -------------------------------------------------------------
order 0 |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | X|   -- out of range --
         -------------------------------------------------------------
order 1 |     |     |     |     |     |     |     |     |     |
         -------------------------------------------------------
order 2 |           |           |           |           |
         -------------------------------------------------
order 3 |                       |                       |
         -------------------------------------------------
         <----------------------> <--------------------->

         page 19 is removed.
         -> page 18 and page 19 cannot be coalesced.
         -> page 16 - page 19 cannot be coalesced.
         -> accessing invalid page 20 will not occur.


[unaligned start address case]
Consider a mem_map begins from index 2.

pfn     0     2     4           8          12           16
               -------------------------------------------------------------------
order 0       |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |
               -------------------------------------------------------------------
order 1       |     |     |     |     |     |     |     |     |     |     |     |
               --------------------------------------------------------------------
order 2             |           |           |           |           |           |
                     -------------------------------------------------------------
order 3                         |                       |                       |
                                 -------------------------------------------------

In this case, invalid mem_map access will occur during
	(1) coalescing page 2 and page 0 in order=1
	(2) coalescing page 4 and page 0 in order=2

calculate_aligned_end() removes page 2 and 4.

pfn     0     2     4           8          12           16
               -------------------------------------------------------------------
order 0       |x |  |x |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |
               -------------------------------------------------------------------
order 1                   |     |     |     |     |     |     |     |     |     |
                           --------------------------------------------------------
order 2                         |           |           |           |           |
                                 -------------------------------------------------
order 3                         |                       |                       |
                                 -------------------------------------------------

	page 2 is removed.
	-> page 2 and page 3 cannot be coalesced in order=0
	-> accessing invalid page 0 in order=1 will not occur.
	
	page 4 is removed.
	-> page 4 and page 5 cannot be coalesced in order=0.
	-> page 4 and page 6 cannot be coalesced in order=1.
	-> accessing invalid page 0 in order=2 will not occur.

Thanks.
--Kame
-- 
--the clue is these footmarks leading to the door.--
KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>


WARNING: multiple messages have this Message-ID (diff)
From: Hiroyuki KAMEZAWA <kamezawa.hiroyu@jp.fujitsu.com>
To: Hiroyuki KAMEZAWA <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Linux Kernel ML <linux-kernel@vger.kernel.org>,
	linux-mm <linux-mm@kvack.org>,
	LHMS <lhms-devel@lists.sourceforge.net>
Subject: Re: [Lhms-devel] [RFC] buddy allocator without bitmap(3) [1/3]
Date: Fri, 03 Sep 2004 08:54:31 +0900	[thread overview]
Message-ID: <4137B2B7.8080109@jp.fujitsu.com> (raw)
In-Reply-To: <4136D318.9060102@jp.fujitsu.com>

> New function: calculate_aligned_end()
> 
> calculate_aligned_end() removes some pages from system for removing invalid
> mem_map access from __free_pages_bulk() main loop.(This is in 4th patch)
> 
This is an illustration of the effects of calculate_aligned_end().

Examples for MAX_ORDER=4 is here.
In this case, an alignment of memmap is (1 << (4-1))=8

[unaligned end address case]

Consider contiguous mem_map from index 0 to index 19.
mem_map[16-19] is unaligned.

pfn     0           4           8          12            16 17 18 19
         -------------------------------------------------------------
order 0 |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  -- out of range --
         -------------------------------------------------------------
order 1 |     |     |     |     |     |     |     |     |     |     |
         -------------------------------------------------------------
order 2 |           |           |           |           |           |
         ------------------------------------------------------------
order 3 |                       |                       |
         -------------------------------------------------
         <----------------------> <---------------------> <---------??? ---->
In this case, invalid mem_map access will occur during

(1) coalescing page 16 with page 20 in order=2. <- this means memory access to page 20.

calculate_aligned_end() removes page 19.

  pfn     0           4           8          12            16 17 18 19
         -------------------------------------------------------------
order 0 |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | X|   -- out of range --
         -------------------------------------------------------------
order 1 |     |     |     |     |     |     |     |     |     |
         -------------------------------------------------------
order 2 |           |           |           |           |
         -------------------------------------------------
order 3 |                       |                       |
         -------------------------------------------------
         <----------------------> <--------------------->

         page 19 is removed.
         -> page 18 and page 19 cannot be coalesced.
         -> page 16 - page 19 cannot be coalesced.
         -> accessing invalid page 20 will not occur.


[unaligned start address case]
Consider a mem_map begins from index 2.

pfn     0     2     4           8          12           16
               -------------------------------------------------------------------
order 0       |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |
               -------------------------------------------------------------------
order 1       |     |     |     |     |     |     |     |     |     |     |     |
               --------------------------------------------------------------------
order 2             |           |           |           |           |           |
                     -------------------------------------------------------------
order 3                         |                       |                       |
                                 -------------------------------------------------

In this case, invalid mem_map access will occur during
	(1) coalescing page 2 and page 0 in order=1
	(2) coalescing page 4 and page 0 in order=2

calculate_aligned_end() removes page 2 and 4.

pfn     0     2     4           8          12           16
               -------------------------------------------------------------------
order 0       |x |  |x |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |
               -------------------------------------------------------------------
order 1                   |     |     |     |     |     |     |     |     |     |
                           --------------------------------------------------------
order 2                         |           |           |           |           |
                                 -------------------------------------------------
order 3                         |                       |                       |
                                 -------------------------------------------------

	page 2 is removed.
	-> page 2 and page 3 cannot be coalesced in order=0
	-> accessing invalid page 0 in order=1 will not occur.
	
	page 4 is removed.
	-> page 4 and page 5 cannot be coalesced in order=0.
	-> page 4 and page 6 cannot be coalesced in order=1.
	-> accessing invalid page 0 in order=2 will not occur.

Thanks.
--Kame
-- 
--the clue is these footmarks leading to the door.--
KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.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/ .
Don't email: <a href=mailto:"aart@kvack.org"> aart@kvack.org </a>

  reply	other threads:[~2004-09-02 23:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-02  8:00 [RFC] buddy allocator without bitmap(3) [1/3] Hiroyuki KAMEZAWA
2004-09-02  8:00 ` Hiroyuki KAMEZAWA
2004-09-02 23:54 ` Hiroyuki KAMEZAWA [this message]
2004-09-02 23:54   ` [Lhms-devel] " Hiroyuki KAMEZAWA

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=4137B2B7.8080109@jp.fujitsu.com \
    --to=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=lhms-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --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 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.