0

I did a web search for differences of mainline vs stable and got Quora What is the difference between Mainline, Stable and Longterm Kernel in linux?:

Stable After each mainline kernel is released, it is considered "stable." Any bug fixes for a stable kernel are backported from the mainline tree and applied by a designated stable kernel maintainer.

However when I downloaded git repos of stable and mainline as referenced from https://www.kernel.org/, I noted stable is 4.4 GB whereas mainline is "only" 2.7 GB. If stable is made from mainline, how can it be so much larger in size?

I got bare repos via git clone --mirror git://.... Interestingly git show gives same output for both repos:

$ git show
commit c9e6606c7fe92b50a02ce51dda82586ebdf99b48 (HEAD -> master, tag: v5.16-rc8)
Author: Linus Torvalds <torvalds@linux-foundation.org>
Date:   Sun Jan 2 14:23:25 2022 -0800

    Linux 5.16-rc8

diff --git a/Makefile b/Makefile
index 17b4319ad2ff..16d7f83ac368 100644
--- a/Makefile
+++ b/Makefile
@@ -2,7 +2,7 @@
 VERSION = 5
 PATCHLEVEL = 16
 SUBLEVEL = 0
-EXTRAVERSION = -rc7
+EXTRAVERSION = -rc8
 NAME = Gobble Gobble
 
 # *DOCUMENTATION*

Added 1:
Cloning stable from https://kernel.googlesource.com as opposed to git://git.kernel.org resulted in same amount of objects,~ 20% more deltas, orders of magnitude more reused and 1.5 times less storage required, another mystery for me.

Added 2:
I've read about reuse in When I do "git push", what do the statistics mean? (Total, delta, etc.). My guess is that google repacked repo with some options different from options used for kernel.org git. I'm trying to run git gc --aggressive, but got frozen for several minutes PC and error: pack-objects died of signal 930040).

~/Downloads$ git_clone https://kernel.googlesource.com/pub/scm/linux/kernel/git/stable/linux.git
Cloning into bare repository './.git'...
remote: Sending approximately 2.15 GiB ...
remote: Counting objects: 9774, done
remote: Finding sources: 100% (5794/5794)
remote: Total 10033935 (delta 8400402), reused 10033919 (delta 8400402)
Receiving objects: 100% (10033935/10033935), 2.15 GiB, done.
Resolving deltas: 100% (8400402/8400402), done.
~/Downloads$ git_clone git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
Cloning into bare repository './.git'...
remote: Enumerating objects: 110, done.
remote: Counting objects: 100% (110/110), done.
remote: Compressing objects: 100% (60/60), done.
remote: Total 10033935 (delta 76), reused 59 (delta 50), pack-reused 10033825
Receiving objects: 100% (10033935/10033935), 3.82 GiB, done.
Resolving deltas: 100% (8004025/8004025), done.
Checking objects: 100% (33554432/33554432), done.

The output of mainline kernel does not show a lot of reuse, so the question why mainline and stable differ in size remains:

~/Downloads$ git_clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Cloning into bare repository './.git'...
remote: Enumerating objects: 110, done.
remote: Counting objects: 100% (110/110), done.
remote: Compressing objects: 100% (60/60), done.
Receiving objects: 100% (8481144/8481144), 2.29 GiB, done.
remote: Total 8481144 (delta 76), reused 59 (delta 50), pack-reused 8481034
Resolving deltas: 100% (6937684/6937684), done.
Martian2020
  • 307
  • 3
  • 12
  • git repos are much larger than the source they contain, because they preserve the history of all changes. – stark Jan 04 '22 at 14:38
  • @stark, any way / tools to compare repos to see what extra history stable repo contains as compared to mainline? – Martian2020 Jan 04 '22 at 22:25
  • git repositories care about the content. Depending on the optimization (`git gc`, the content can be more packed). In any case, the signatures consider the plain text, so you can verify that the repo is correct – Giacomo Catenazzi Jan 05 '22 at 09:23
  • 3
    The stable repository contains many branches (one branch per mainline release from 2.6.11 onwards), each with their own set of "stable" commits, in addition to the "master" branch. That is why it is significantly larger than the mainline repository. – Ian Abbott Jan 06 '22 at 17:18
  • @IanAbbott, I see now, stable contains many stable releases. Please write a short answer, basically just copy of the comment is ok IMO. – Martian2020 Jan 07 '22 at 02:03

0 Answers0