# Re: \[PATCH v2\] powerpc/powernv: Cache OPAL check\_token() results

- From: Nikhil Kumar Singh \<hidden\>
- Date: 2026-07-09 06:05:12 
- List: linuxppc-dev
- Page: https://ratatoskr.run/linuxppc-dev/2026/07/17234329
- Thread: https://ratatoskr.run/linuxppc-dev/2026/06/17180197/t.md

```text
I discussed this with Sourabh, and we confirmed this function is actually not on a hot path. However, he is open to the idea. Please take a look and see if adding unlikely() provides a meaningful benefit here, or if it falls into premature optimization.

Thanks
~ Nikhil

On 08/07/26 14:02, Shivang Upadhyay wrote:
> On Tue, 2026-07-07 at 12:36 +0530, Nikhil Kumar Singh wrote:
>> You can wrap the if (token_cache[token] == SUPP_UNKNOWN) check, as well as the if (token > OPAL_LAST) check above it, with unlikely(), since this function is in the hot path. Out-of-bounds tokens are very rare, and after the cache is populated, the SUPP_UNKNOWN condition is expected to be false in almost all cases. Wrapping these checks with unlikely() will help the compiler optimize branch
>
> Thanks for your suggestion, but Which hotpath code is calling this?
> we can maybe change that hotpath to not do rtas calls.
>
> ~Shivang.
```
