Re: [PATCH v3 2/2] libfdt: Add FDT_CREATE_FLAG_NO_NAME_DEDUP flag that trades size for speed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



David Gibson's on May 7, 2019 10:00 am:
> On Mon, May 06, 2019 at 08:13:59PM +1000, Nicholas Piggin wrote:
>> Searching for duplicate names scales O(n^2) with the number of names
>> added to a fdt, which can cause a noticable slowdown with larger device
>> trees and very slow CPU cores.
>> 
>> Add FDT_CREATE_FLAG_NO_NAME_DEDUP that allow the caller to trade fdt size
>> for speed in the creation process.
>> 
>> Signed-off-by: Nicholas Piggin <npiggin@xxxxxxxxx>
> 
> LGTM, but something's clearly wrong: the nodedup testcases, far from
> being faster, wedge indefinitely for me (x86 Fedora 30 host).

I initially had a bug in the argument parsing, str was not set to
NULL for strtok, which caused an infinite loop.

>> +	if (argc == 3) {
>> +		char *str = argv[2], *saveptr, *tok;
>> +		bool default_flag = false;
>> +
>> +		while ((tok = strtok_r(str, ",", &saveptr)) != NULL) {
>> +			str = NULL;
                        ^^^
>> +			if (streq(tok, "default")) {
>> +				default_flag = true;
>> +			} else if (streq(tok, "no_name_dedup")) {
>> +				create_flags |= FDT_CREATE_FLAG_NO_NAME_DEDUP;
>> +			} else if (streq(tok, "bad")) {
>> +				create_flags |= 0xffffffff;

Did you rebuild tests? Is it hanging in sw_tree1 or infinite looping
in the harness repeatedly invoking sw_tree1?

Thanks,
Nick





[Index of Archives]     [Device Tree]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux