You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
powerpc: Dynamically allocate pacas
On 64-bit kernels we currently have a 512 byte struct paca_struct for each cpu (usually just called "the paca"). Currently they are statically allocated, which means a kernel built for a large number of cpus will waste a lot of space if it's booted on a machine with few cpus. We can avoid that by only allocating the number of pacas we need at boot. However this is complicated by the fact that we need to access the paca before we know how many cpus there are in the system. The solution is to dynamically allocate enough space for NR_CPUS pacas, but then later in boot when we know how many cpus we have, we free any unused pacas. Signed-off-by: Michael Ellerman <michael@ellerman.id.au> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
This commit is contained in:
committed by
Benjamin Herrenschmidt
parent
59603b9ae4
commit
1426d5a3bd
@@ -219,7 +219,8 @@ generic_secondary_common_init:
|
||||
* physical cpu id in r24, we need to search the pacas to find
|
||||
* which logical id maps to our physical one.
|
||||
*/
|
||||
LOAD_REG_ADDR(r13, paca) /* Get base vaddr of paca array */
|
||||
LOAD_REG_ADDR(r13, paca) /* Load paca pointer */
|
||||
ld r13,0(r13) /* Get base vaddr of paca array */
|
||||
li r5,0 /* logical cpu id */
|
||||
1: lhz r6,PACAHWCPUID(r13) /* Load HW procid from paca */
|
||||
cmpw r6,r24 /* Compare to our id */
|
||||
@@ -536,7 +537,8 @@ _GLOBAL(pmac_secondary_start)
|
||||
mtmsrd r3 /* RI on */
|
||||
|
||||
/* Set up a paca value for this processor. */
|
||||
LOAD_REG_ADDR(r4,paca) /* Get base vaddr of paca array */
|
||||
LOAD_REG_ADDR(r4,paca) /* Load paca pointer */
|
||||
ld r4,0(r4) /* Get base vaddr of paca array */
|
||||
mulli r13,r24,PACA_SIZE /* Calculate vaddr of right paca */
|
||||
add r13,r13,r4 /* for this processor. */
|
||||
mtspr SPRN_SPRG_PACA,r13 /* Save vaddr of paca in an SPRG*/
|
||||
|
||||
Reference in New Issue
Block a user