On Thu, Sep 8, 2022 at 8:38 AM Kumar Kartikeya Dwivedi <memxor@xxxxxxxxx> wrote: > > > > Are you expecting the verifier to insert zero inits > > as actual insns after 'call bpf_kptr_new' insn ? > > Hmm. I imagined bpf_kptr_new helper will do it. > > Just a simple loop that is inverse of zero_map_value(). > > Not the fastest thing, but good enough to start and can be > > optimized later. > > The verifier can insert ST insn too in !null branch, > > since that insn only needs one register and it's known > > in that branch. > > It's questionable that a bunch of ST insns will be faster > > than a zero_map_value-like loop. > > I would definitely think a bunch of direct 0 stores would be faster. > zero_map_value will access some kind of offset array in memory and > then read from it and loop over to do the stores. > Does seem like more work to do, even if it's hot in cache those are > unneeded extra accesses for information we know statically. > So I'll most likely emit a bunch of ST insns zeroing it out in v1. Premature optimization is ...