Re: [PATCH v1 1/2] ACPI: scan: Rearrange memory allocation in acpi_device_add()

2021-01-18 Thread Rafael J. Wysocki
On Sat, Jan 16, 2021 at 1:37 PM Hans de Goede wrote: > > Hi, > > On 1/14/21 7:46 PM, Rafael J. Wysocki wrote: > > From: Rafael J. Wysocki > > > > The upfront allocation of new_bus_id is done to avoid allocating > > memory under acpi_device_lock, but it doesn't really help, > > because (1) it lead

Re: [PATCH v1 1/2] ACPI: scan: Rearrange memory allocation in acpi_device_add()

2021-01-18 Thread Hans de Goede
Hi, On 1/18/21 4:32 PM, Andy Shevchenko wrote: > On Mon, Jan 18, 2021 at 04:16:16PM +0100, Rafael J. Wysocki wrote: >> On Sat, Jan 16, 2021 at 1:37 PM Hans de Goede wrote: >>> On 1/14/21 7:46 PM, Rafael J. Wysocki wrote: > > ... > >>> When I have cases like this, where 2 mallocs are necessary I

Re: [PATCH v1 1/2] ACPI: scan: Rearrange memory allocation in acpi_device_add()

2021-01-18 Thread Andy Shevchenko
On Mon, Jan 18, 2021 at 04:16:16PM +0100, Rafael J. Wysocki wrote: > On Sat, Jan 16, 2021 at 1:37 PM Hans de Goede wrote: > > On 1/14/21 7:46 PM, Rafael J. Wysocki wrote: ... > > When I have cases like this, where 2 mallocs are necessary I typically do > > it like this: > > > > const ch

Re: [PATCH v1 1/2] ACPI: scan: Rearrange memory allocation in acpi_device_add()

2021-01-18 Thread Hans de Goede
Hi, On 1/18/21 4:16 PM, Rafael J. Wysocki wrote: > On Sat, Jan 16, 2021 at 1:37 PM Hans de Goede wrote: >> >> Hi, >> >> On 1/14/21 7:46 PM, Rafael J. Wysocki wrote: >>> From: Rafael J. Wysocki >>> >>> The upfront allocation of new_bus_id is done to avoid allocating >>> memory under acpi_device_l

Re: [PATCH v1 1/2] ACPI: scan: Rearrange memory allocation in acpi_device_add()

2021-01-16 Thread Hans de Goede
Hi, On 1/14/21 7:46 PM, Rafael J. Wysocki wrote: > From: Rafael J. Wysocki > > The upfront allocation of new_bus_id is done to avoid allocating > memory under acpi_device_lock, but it doesn't really help, > because (1) it leads to many unnecessary memory allocations for > _ADR devices, (2) kstrd

[PATCH v1 1/2] ACPI: scan: Rearrange memory allocation in acpi_device_add()

2021-01-14 Thread Rafael J. Wysocki
From: Rafael J. Wysocki The upfront allocation of new_bus_id is done to avoid allocating memory under acpi_device_lock, but it doesn't really help, because (1) it leads to many unnecessary memory allocations for _ADR devices, (2) kstrdup_const() is run under that lock anyway and (3) it complicate