Skip to content

Commit

Permalink
sh: Don't allocate smaller sized mappings on every iteration
Browse files Browse the repository at this point in the history
Currently, we've got the less than ideal situation where if we need to
allocate a 256MB mapping we'll allocate four entries like so,

	 entry 1: 128MB
	 entry 2:  64MB
	 entry 3:  16MB
	 entry 4:  16MB

This is because as we execute the loop in pmb_remap() we will
progressively try mapping the remaining address space with smaller and
smaller sizes. This isn't good because the size we use on one iteration
may be the perfect size to use on the next iteration, for instance when
the initial size is divisible by one of the PMB mapping sizes.

With this patch, we now only need two entries in the PMB to map 256MB of
address space,

	  entry 1: 128MB
	  entry 2: 128MB

Signed-off-by: Matt Fleming <matt@console-pimps.org>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
  • Loading branch information
Matt Fleming authored and Paul Mundt committed Oct 9, 2009
1 parent 2bea7ea commit a2767cf
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions arch/sh/mm/pmb.c
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,13 @@ long pmb_remap(unsigned long vaddr, unsigned long phys,
pmbp->link = pmbe;

pmbp = pmbe;

/*
* Instead of trying smaller sizes on every iteration
* (even if we succeed in allocating space), try using
* pmb_sizes[i].size again.
*/
i--;
}

if (size >= 0x1000000)
Expand Down

0 comments on commit a2767cf

Please sign in to comment.