[SLOF] [PATCH] base: increase catpad buffer

Nikunj A Dadhania nikunj at linux.vnet.ibm.com
Thu Nov 30 16:23:57 AEDT 2017


Hi Segher,

Segher Boessenkool <segher at kernel.crashing.org> writes:

> On Tue, Nov 28, 2017 at 03:31:43PM +0530, Nikunj A Dadhania wrote:
>> Segher Boessenkool <segher at kernel.crashing.org> writes:
>> > On Tue, Nov 28, 2017 at 01:08:09PM +0530, Nikunj A Dadhania wrote:
>> >> Current buffer of 1K is not sufficient, and causes exception if more than 20
>> >> devices are used with bootindex. Increase the buffer size to 16K
>> >
>> > Concatenating many strings this way is quadratic in the total length,
>> > which is very painful with 1k already but ridiculously slow with 16k.
>> > Use a better method?  $cat is a nice simple lazy utility word, it is
>> > not good for constructing unbounded lists.
>> 
>> : load
>> [...]
>>    set-boot-args s" parse-load " $bootdev $cat strdup evaluate
>> ;
>> 
>> Thats where we are hitting the limit. Maybe we can allocate and copy
>> both these strings without using the catpad?
>
> Do you need to at all?  parse-load wants to have the $bootdev string
> as input buffer, so you can do
>
> : load
>   [...]
>   set-boot-args
>   save-source  -1 to source-id
>   $boot-dev  dup #ib !  span !  to ib
>   ['] parse-load catch  restore-source  throw  ;

Had to add " 0 >in !" as used in interpret. Works after that, need your
input if the below is correct? 

diff --git a/slof/fs/boot.fs b/slof/fs/boot.fs
index 1fd7439..c2b7551 100644
--- a/slof/fs/boot.fs
+++ b/slof/fs/boot.fs
@@ -221,7 +221,11 @@ defer go ( -- )
    ELSE
       drop
    THEN
-   set-boot-args s" parse-load " $bootdev $cat strdup evaluate
+   set-boot-args
+   save-source  -1 to source-id
+   $bootdev dup #ib ! span ! to ib
+   0 >in !
+   ['] parse-load catch restore-source throw
 ;
 
 : load-next ( -- success )     \ Continue after go failed


Regards
Nikunj



More information about the SLOF mailing list