Drop node-local allocation during host controller initialisation
cover Drop node-local allocation during host controller initialisation
Hi Bjorn,
As discussed before[0], here are a couple of patches to drop node-local allocations during host contoller initialisation. This set covers both arm64 and x86.
I'm posting early to give the patches time on the list as well in next in case there are issues we've missed.
The patches are based on v4.19-rc1 and has been boot tested on arm64 and compile tested on x86.
Thanks,
Punit
[0] https://www.spinics.net/lists/arm-kernel/msg669746.html
Punit Agrawal (2):
arm64: PCI: Remove node-local allocations when initialising host
controller
x86/PCI: Remove node-local allocation when initialising host
controller
arch/arm64/kernel/pci.c | 5 ++--- arch/x86/pci/acpi.c | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-)
Signature · 1 line
2.18.0
PATCH 1/2 arm64: PCI: Remove node-local allocations when initialising host controller
Memory for host controller data structures is allocated local to the node to which the controller is associated with. This has been the behaviour since support for ACPI was added in
commit 0cb0786bac15 ("ARM64: PCI: Support ACPI-based PCI host controller").
Drop the node local allocation as there is no benefit from doing so - the usage of these structures is independent from where the controller is located.
--- arch/arm64/kernel/pci.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
arch/arm64/kernel/pci.c +2 -3
@@ -165,16 +165,15 @@ static void pci_acpi_generic_release_info(struct acpi_pci_root_info *ci)/* Interface called from ACPI code to setup PCI host controller */ struct pci_bus *pci_acpi_scan_root (struct acpi_pci_root *root) { -int node =acpi_get_node (root->device->handle);struct acpi_pci_generic_root_info *ri;struct pci_bus *bus, *child;struct acpi_pci_root_ops *root_ops; - ri =kzalloc_node (sizeof (*ri),GFP_KERNEL , node); + ri =kzalloc (sizeof (*ri),GFP_KERNEL );if (!ri)return NULL ; - root_ops =kzalloc_node (sizeof (*root_ops),GFP_KERNEL , node); + root_ops =kzalloc (sizeof (*root_ops),GFP_KERNEL );if (!root_ops) {kfree (ri);return NULL ;
Signature · 1 line
2.18.0
Re: [PATCH 1/2] arm64: PCI: Remove node-local allocations when initialising host controller
Quoted 9 lines · Punit Agrawal
Memory for host controller data structures is allocated local to the node to which the controller is associated with. This has been the behaviour since support for ACPI was added in
commit0cb0786bac15("ARM64: PCI: Support ACPI-based PCI host controller").Drop the node local allocation as there is no benefit from doing so - the usage of these structures is independent from where the controller is located.
Quoted 8 lines
Signed-off-by Punit Agrawal <[email protected]>Cc Catalin Marinas <[email protected]>Cc Will Deacon <[email protected]>Cc Lorenzo Pieralisi <[email protected]>--- arch/arm64/kernel/pci.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
Will
Quoted 26 lines
arch/arm64/kernel/pci.c +2
-3@@ -165,16 +165,15 @@ static void pci_acpi_generic_release_info(struct acpi_pci_root_info *ci)/* Interface called from ACPI code to setup PCI host controller */ struct pci_bus *pci_acpi_scan_root (struct acpi_pci_root *root) { -int node =acpi_get_node (root->device->handle);struct acpi_pci_generic_root_info *ri;struct pci_bus *bus, *child;struct acpi_pci_root_ops *root_ops; - ri =kzalloc_node (sizeof (*ri),GFP_KERNEL , node); + ri =kzalloc (sizeof (*ri),GFP_KERNEL );if (!ri)return NULL ; - root_ops =kzalloc_node (sizeof (*root_ops),GFP_KERNEL , node); + root_ops =kzalloc (sizeof (*root_ops),GFP_KERNEL );if (!root_ops) {kfree (ri);return NULL ;Signature · 1 line
2.18.0
PATCH 2/2 x86/PCI: Remove node-local allocation when initialising host controller
In reply to Punit AgrawalMemory for host controller data structures is allocated local to the node to which the controller is associated with. This has been the behaviour since 965cd0e4a5e5 ("x86, PCI, ACPI: Use kmalloc_node() to optimize for performance") where the node local allocation was added without additional context.
Drop the node local allocation as there is no benefit from doing so - the usage of these structures is independent from where the controller is located.
--- arch/x86/pci/acpi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/pci/acpi.c +1 -1
@@ -356,7 +356,7 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root) }else {struct pci_root_info *info; - info =kzalloc_node (sizeof (*info),GFP_KERNEL , node); + info =kzalloc (sizeof (*info),GFP_KERNEL );if (!info) dev_err(&root->device->dev, "pci_bus %04x:%02x: ignored (out of memory)\n",
Signature · 1 line
2.18.0
Quoted 23 lines · Punit Agrawal
Hi Bjorn,
As discussed before[0], here are a couple of patches to drop node-local allocations during host contoller initialisation. This set covers both arm64 and x86.
I'm posting early to give the patches time on the list as well in next in case there are issues we've missed.
The patches are based on v4.19-rc1 and has been boot tested on arm64 and compile tested on x86.
Thanks,
Punit[0] https://www.spinics.net/lists/arm-kernel/msg669746.html
Punit Agrawal (2):
arm64: PCI: Remove node-local allocations when initialising host
controller
x86/PCI: Remove node-local allocation when initialising host
controller
Quoted 3 lines
arch/arm64/kernel/pci.c | 5 ++--- arch/x86/pci/acpi.c | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-)
Applied with Will's ack on the arm64 patch to pci/enumeration for v4.20, thanks!