lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ef734312-0b5f-1ceb-9a51-eb49f9e43e3c@redhat.com>
Date:   Wed, 12 Jun 2019 18:33:05 +0200
From:   Daniel Bristot de Oliveira <bristot@...hat.com>
To:     Peter Zijlstra <peterz@...radead.org>
Cc:     linux-kernel@...r.kernel.org, Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
        "H. Peter Anvin" <hpa@...or.com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Masami Hiramatsu <mhiramat@...nel.org>,
        "Steven Rostedt (VMware)" <rostedt@...dmis.org>,
        Jiri Kosina <jkosina@...e.cz>,
        Josh Poimboeuf <jpoimboe@...hat.com>,
        Chris von Recklinghausen <crecklin@...hat.com>,
        Jason Baron <jbaron@...mai.com>, Scott Wood <swood@...hat.com>,
        Marcelo Tosatti <mtosatti@...hat.com>,
        Clark Williams <williams@...hat.com>, x86@...nel.org
Subject: Re: [PATCH V6 4/6] x86/alternative: Batch of patch operations

On 12/06/2019 16:52, Peter Zijlstra wrote:
> On Wed, Jun 12, 2019 at 11:57:29AM +0200, Daniel Bristot de Oliveira wrote:
> 
>> When a static key has more than one entry, these steps are called once for
>> each entry. The number of IPIs then is linear with regard to the number 'n' of
>> entries of a key: O(n*3), which is O(n).
> 
>> Doing the update in this way, the number of IPI becomes O(3) with regard
>> to the number of keys, which is O(1).
> 
> That's not quite true, what you're doing is n/X, which, in the end, is
> still O(n).
> 
> It just so happens your X is 128, and so any n smaller than that ends up
> being 1.
> 

Correct! In the v1, when I was using a (dynamic) linked list of keys, it was
O(1), now it is O(n).

Using an academic hat of easy assumptions, I could argue that:

"Doing the update in this way, the number of IPI becomes O(3) with regard to the
number of keys*, which is O(1).

* Given that the number of elements in the vector is larger than or equals to
the numbers of entries of a given key, O(n) otherwise."

Life is so easy when we can do such assumptions, like infinity memory :-)

So, yeah, with a fixed size vector, it is O(n) in the worst case, but still
"O(1)" in the vast majority of cases.

-- Daniel

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ