They are compiler hints for GCC. They're used in conditionals to tell the compiler if a branch is likely to be taken or not. It can help the compiler laying down the code in such a way that's optimal for the most frequent outcome.
They are used like this:
if (likely(some_condition)) {
// the compiler will try and make the code layout optimal for the case
// where some_condition is true, i.e. where this block is run
most_likely_action();
} else {
// this block is less frequently used
corner_case();
}
It should be used with great care (i.e. based on actual branch profiling results). A wrong hint can degrade performance (obviously).
Some examples of how the code can be optimized are easily found by searching for GCC __builtin_expect
. This blog post gcc optimisation: __builtin_expect for example details a disassembly with it.
The kind of optimizations that can be done is very processor-specific. The general idea is that often, processors will run code faster if it does not branch/jump all over the place. The more linear it is, and the more predictable the branches are, the faster it will run. (This is especially true for processors with deep pipelines for example.)
So the compiler will emit the code such that the most likely branch will not involve a jump if that's what the target CPU prefers, for instance.
The kernel is written in C. "Kernel data structures" would just refer to various formations (trees, lists, arrays, etc.) of mostly compound types (struct
s and union
s) defined in the source, which C code is normally filled with stuff like that. If you don't understand C, they will not be meaningful to you.
Data structures structure the storage of information in memory or address space. There is nothing particularly special about the ones used by the linux kernel. Some of them can/must be used if you are writing a kernel module, but their use is completely internal to the kernel. Kernel memory is only accessed by the kernel and it's structure has no relevance to anything else.
Best Answer
LTR stands for Long Term Release. This is also known as a LTSR, short for Long Term Support Release. These releases are supported for a longer time, and are meant to be used in Production Environments, where stability is preferred over new features. In terms of the kernel you are reading about, the LTR cycle is about 3 years. This means if you are a user who needs stability, if you download an LTR kernel, it will be supported upstream for the next 3 Years. The definitive source for Linux Kernels are the Linux Kernel Archives.