Errata

Understanding the Linux Kernel

Errata for Understanding the Linux Kernel

Submit your own errata for this product.

The errata list is a list of errors and their corrections that were found after the product was released. If the error was corrected in a later version or reprint the date of the correction will be displayed in the column titled "Date Corrected".

The following errata were submitted by our customers and approved as valid errors by the author or editor.

Color key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted By Date submitted Date corrected
Page Chapter 13, section 13.2
6th paragraph

In section "13.2 Determining OOM Status" in 2nd paragraph, under the "Figure 13.1: Call Graph: out_of_memory()", in second sentence there is a typo.

It says "unnecessarily opening the possibly of processes being unnecessarily killed."

The word "possibly" shall read "possibility".

Thank you.

Note from the Author or Editor:
Thank you!

Marco Cesati

Pawel Suchanecki  Apr 26, 2022 
Printed
Page 11
under the section "Kernel Architecture, second paragraph

The sentence starting with "Moreover, ..." uses "easily" twice, when it should only be used once.

Note from the Author or Editor:
Change the beginning of the sentence

"Moreover, an existing microkernel operating system can be easily ported to other architectures fairly easily, [...]"

into

"Moreover, an existing microkernel operating system can be ported to other architectures fairly easily, [...]"

(MC)

Anonymous  Nov 12, 2014 
Printed
Page 58
3rd paragraph

"see Table 2-2" should be "see Table 2-4".

Note from the Author or Editor:
CONFIRMED

Change "see Table 2-2" to "see Table 2-4"

(MC)

Sam Sandbote  Feb 06, 2009 
Other Digital Version
63
table 2-7 pgd_offset

in the description of pgd_offset(mm, addr), 'cw' should be 'mm'

Receive as parameters the address of a memory descriptor cw (see Chapter 9)


same typo in table 2-8 of page 65, description of pmd_alloc(mm, pud, addr).

Note from the Author or Editor:
CONFIRMED

Change "the address of a memory descriptor cw" to "the address of a memory descriptor mm"

[Opening another ticket for the other typo noticed by the reader]

(MC)

mplus  Oct 10, 2014 
Printed, PDF
Page 65
Table 2-8, entry "pmd_alloc"

At the end of the description for the entry "pmd_alloc(mm, pud, addr)", change the sentence
"The argument cw is ignored" to "The argument mm is ignored"

(MC)

Marco Cesati
 
Oct 10, 2014 
Printed
Page 86
4th paragraph, 2rd line

"the stack is stored starting at address 0x015fc000", should be "address 0x015fbfff.

Note from the Author or Editor:
CONFIRMED

Change "the stack is stored starting at address 0x015fc000" to
"the stack is stored at addresses below 0x015fc000"

(MC)

Anonymous  Dec 28, 2009 
Printed
Page 118
7th paragraph(step c in step 5)

I've checked the source code of wake_up_new_task function.
It gose like
void fastcall wake_up_new_task(task_t * p, unsigned long clone_flags)
{
...
rq = task_rq_lock(p, &flags);
cpu = task_cpu(p);
this_cpu = smp_processor_id();
...
if(likely(cpu == this_cpu)) {
if(!clone_flags & CLONE_VM)) {
...
list_add_tail(&p->run_list, &current->run_list);
...
} else
__activate_task(p, rq); /* add to the end*/
} else {
...
__activate_task(p, rq);/* rq is child's runqueue*/
}
}
Orinally, in the boot, it said that "Otherwise, if the child will not be run on the same CPU as the parent, or parent and child share the same set of page tables, it inserts the child in the last position of the parent's runqueue".
I think it's not 100 percent corrent. Because, as the souce code just listed implies, when the child and parent will not run on the same CPU, the child will not be added to the parent's runqueue and will be added to the child's runqueue.(different cpu different runqueue). Another point the souce code reveals is that when the child and parent will run on the same cpu and they share page tables, the child will be added to the last position of the parent's runqueue.

Note from the Author or Editor:
CONFIRMED

The last sentence in item 5c should be changed from

"it inserts the child in the last position of the parent's runqueue"

to

"it inserts the child in the last position of the runqueue"

(MC)

Anonymous  Oct 17, 2008 
Other Digital Version
144
1st paragraph just below the Figure 4-3

... an interrupt handler must never block, that is, no process switch can take place __until__ an
interrupt handler is running.

"place until an" should now read "place while an"

Anonymous    Jul 01, 2008
Printed
Page 144
1st paragraph just below the Figure 4-3

... an interrupt handler must never block, that is, no process switch can take place __until__ an
interrupt handler is running.

"place until an" should now read "place while an"

Anonymous    Aug 01, 2008
157
17th line (except for tables)

"if depth is equal to 0, the function disables the IRQ line"
In this statement, I think 'equal to 0' should be 'greater than 0',

According to Table 4-4, depth shows 0 if the IRQ line is enabled.

Note from the Author or Editor:
CONFIRMED

Change "if depth is equal to 0" to "if the old value of depth was 0"

(MC)

Ilsoo Byun  May 30, 2013 
Printed
Page 173
3rd paragraph, below table 4-9

A typo: softirq is spelled sofirq
"The index of a sofirq"

Note from the Author or Editor:
CONFIRMED

"sofirq" should be changed to "softirq" (MC)

Anonymous  Aug 10, 2008 
Page 178
In item 3

The text says "Sets the CW flag of cr0". I tried to find out more information what that flag is, and couldn't find any. It's not mentioned in the book at all.

I figured out it must mean the TS flag, because the code below "or"s the value with 8, and TS is the 3th bit of cr0 ( https://en.wikipedia.org/wiki/Control_register#CR0 ).

The error is repeated on page 179.

While googling, I also found a PDF of the book where this error is corrected. However, the Kindle version (bought in early 2022) has this error, so it would be great to include it in the Errata, to make readers less confused.

Marja Hölttä  Jun 18, 2022 
Printed
Page 179
5th paragraph

the following bullet item:

1. Checks the TASKLET_STATE_SCHED flag; if it is set, returns (the taslet has already been scheduled).

It should be something like:

1. Checks the TASKLET_STATE_SCHED flag; if it is set, returns (the taslet has already been scheduled); otherwise set TASKLET_STATE_SCHED bit and continue to step 2.

According to the code, test_and_set_bit() is used. Therefore, here TASKLET_STATE_SCHED bit will be set if not. IMO this is important because the section explained where TASKLET_STATE_SCHED is cleared, but not where it is set, which is confusing to me before I checked the source code.

Note from the Author or Editor:
CONFIRMED

The sentence in item 1 should be changed to:

"Checks the TASKLET_STATE_SCHED flag; if it is set, returns (the tasklet has already been scheduled); otherwise set the TASKLET_STATE_SCHED bit."

(MC)

Anonymous  Sep 29, 2008 
Other Digital Version
179
Your WEB site's errata has an erratum error re: paragraph 5

The erratum that shows up on the web, for page 179, paragraph 5 has an error.

Your web errata page suggestion is to change the printed page to read ... “Checks the TASKLET_STATE_SCHED flag; if it is set, returns (the taslet has already been scheduled); otherwise set the TASKLET_STATE_SCHED bit."

In that erratum suggestion, the parenthetical phrase
"(the taslet...)"
should read as follows:
"(the tasklet ...)"

NOTE: the missing letter "k" in the erroneous erratum

Sincerely;
Terry Wa5nti McCarty

Note from the Author or Editor:
This report is about an erratum entry rather than an error in the book.

I already fixed the erratum entry. No change on the book text should be required.

(MC)

Terry Wa5nti McCarty  Jan 19, 2015 
Printed, PDF
Page 184
Table 4-15

In the heading sentence of Table 4-15, "(continues)" is wrong because the table is not spllited among pages

Change "The flags field of the thread_info descriptor (continues)" to "The flags field of the thread_info descriptor"

(MC)

Marco Cesati
 
Oct 10, 2014 
Printed
Page 191
sentence prior to Table 5-1

"prempt_count" should be "preempt_count"

Note from the Author or Editor:
CONFIRMED

change "prempt_count" to "preempt_count" (MC)

David Sanderson  Jun 22, 2009 
Printed
Page 265
last paragraph, 2nd line

The line reads "... from 1 (highest priority) to 99 (lowest priority)."
This should be reversed "from 99 (high) to 1 (low)."

Priority scheduling is done such that "Processes with numerically higher priority values are scheduled before processes with numerically lower priority values. Thus, the value returned by sched_get_priority_max() will be greater than the value returned by sched_get_priority_min()." (from the manual page for sched_get_priority_max). In practice, the results conform to the behavior specified by the manual pages. (RedHat Enterprise Linux 4 & 5 using Linux kernel 2.6)

Note from the Author or Editor:
CONFIRMED

Change "ranging from 1 (highest priority) to 99 (lowest priority)" to
"ranging from 1 (lowest priority) to 99 (highest priority)"

(MC)

Kevin Quigley  Jun 30, 2011 
289
2nd paragraph (step 7)

If the move_task() function failed
should be
If the move_tasks() function failed

Note from the Author or Editor:
CONFIRMED

Change "move_task()" to "move_tasks()"

(MC)

Namhyung Kim  Nov 14, 2009 
312
last paragraph

When kernel finds 256 page frames in the 1024-page-frame list, the "last" 512 of the remaining 768 page frames are inserted into the free list.

Note from the Author or Editor:
CONFIRMED

The sentence

"If such a block exists, it allocates 256 of the 1024 page frames to satisfy the request, inserts the first 512 of the remaining 768 page frames into the list of free 512-page-frame blocks, and inserts the last 256 page frames into the list of free 256-page-frame blocks."

should be changed to

"If such a block exists, it allocates 256 of the 1024 page frames to satisfy the request, inserts the first 256 of the remaining 768 page frames into the
list of free 256-page-frame blocks, and inserts the last 512 page frames into the list
of free 512-page-frame blocks."

Namhyung Kim  Nov 17, 2009 
321
last paragraph (step 4)

"PF_MEMDIE" should be "TIF_MEMDIE"

Note from the Author or Editor:
CONFIRMED

Change "PF_MEMDIE" to "TIF_MEMDIE"

(MC)

Namhyung Kim  Nov 18, 2009 
327
middle of page (description of "External slap descriptor")

"cache_sizes" should be "malloc_sizes"

Note from the Author or Editor:
CONFIRMED

Change "cache_sizes" to "malloc_sizes"

Namhyung Kim  Nov 18, 2009 
327
3rd from the last paragraph

"512MB" should be "512 (byte)"

Note from the Author or Editor:
CONFIRMED

Change "512MB" to "512 bytes"

(MC)

Anonymous  Nov 18, 2009 
Other Digital Version
329
the third line to the last of the code piece following 3rd paragraph

Replaced the two lines

while (i--)
SetPageSlab(page++);

with the following two lines:

while (--i >= 0)
SetPageSlab(page+i);

Anonymous    Jul 01, 2008
Printed
Page 329
the third line to the last of the code piece following 3rd paragraph

Replaced the two lines

while (i--)
SetPageSlab(page++);

with the following two lines:

while (--i >= 0)
SetPageSlab(page+i);

Anonymous    Aug 01, 2008
331
1st item under the "Releasing a Slab from a Cache"

'(see the later section "Releasing a Slab from a Cache")' should be removed or refer other section

Note from the Author or Editor:
CONFIRMED

Change the sentence from

"see the later section "Releasing a Slab from a Cache"

to

"see the later section "Freeing a Slab Object"

(MC)

Namhyung Kim  Nov 18, 2009 
Printed
Page 335
Figure 8-6

(335): comment in figure 8-6 "num+osize" should be "num*osize".

Note from the Author or Editor:
CONFIRMED

Inside figure 8-6, the string "num + osize" must be replaced by "num x osize"
('x' must be the multiplier symbol) (MC)

Anonymous  Jul 04, 2008 
Other Digital Version
335
Figure 8-6

"num+osize" should now read "num*osize" ('*' should be the multiplication cross operator)

Anonymous    Jul 01, 2008
Printed
Page 335
Figure 8-6

"num+osize" should now read "num*osize" ('*' should be the multiplication cross operator)

Anonymous    Aug 01, 2008
Other Digital Version
336
1st line of last paragraph

"also sport" should now read "also include"

Anonymous    Jul 01, 2008
Printed
Page 336
1st line of last paragraph

"also sport" should now read "also include"

Anonymous    Aug 01, 2008
342
3rd last paragraph

"if the __GFP_WAIT flag is not set" should be "if the __GFP_WAIT flag is set"

Note from the Author or Editor:
CONFIRMED

Change "if the __GFP_WAIT flag is not set" to "if the __GFP_WAIT flag is set"

(MC)

Namhyung Kim  Dec 05, 2009 
345
middle of the vmalloc() code

"if (!area_pages)" should be "if (!area->pages)"

Note from the Author or Editor:
CONFIRMED

Change "if (!area_pages)" to "if (!area->pages)"

(MC)

Namhyung Kim  Nov 19, 2009 
375
step 11.d

"mm->anon_vma" should be "vma->anon_vma"

Note from the Author or Editor:
CONFIRMED

Change "mm->anon_vma" to "vma->anon_vma"

(MC)

Namhyung Kim  Nov 23, 2009 
379
2nd code snippet

"if (!(error_code & 0x101))" should be "if (!(error_code & 5))" (or "0b101" if C syntax can support such a binary number)

Note from the Author or Editor:
CONFIRMED

Change "if (!(error_code & 0x101))" to "if (!(error_code & 5))"

(MC)

Namhyung Kim  Nov 23, 2009 
390
2nd code snippet

"kunmap_atomic(vto, KM_USER0)" should be "kunmap_atomic(vto, KM_USER1)"

Note from the Author or Editor:
CONFIRMED

Change "kunmap_atomic(vto, KM_USER0)" to "kunmap_atomic(vto, KM_USER1)"

(MC)

Namhyung Kim  Nov 23, 2009 
404
1st paragraph

"except TIF_POLLING_NRFLAG" should be "except TIF_POLLING_NRFLAG and TIF_MEMDIE"

Note from the Author or Editor:
CONFIRMED

Change "except TIF_POLLING_NRFLAG" to "except TIF_POLLING_NRFLAG and
TIF_MEMDIE"

(MC)

Namhyung Kim  Nov 24, 2009 
Printed
Page 411
2rd paragrah

int sys_fork(struct pt_regs regs)
should be
int sys_fork(struct pt_regs *regs)

Note from the Author or Editor:
The line
"int sys_fork(struct pt_regs regs)"
should be changed to
"int sys_fork(struct pt_regs *regs)"

mplus  Oct 29, 2014 
419
middle of the code

"-125" should be "-129"

Note from the Author or Editor:
CONFIRMED

Change "cmpl $-125, %eax" to "cmpl $-129,%eax"

(MC)

Namhyung Kim  Nov 26, 2009 
496
table 12-15 2nd field

"struct vfs_mount" should be "struct vfsmount"

Note from the Author or Editor:
CONFIRMED

Change "struct vfs_mount" to "struct vfsmount"

(MC)

Namhyung Kim  Dec 01, 2009 
512
last paragraph

"lock_file" should be "file_lock"

Note from the Author or Editor:
CONFIRMED

Two changes are required.

Change "All lock_file structures that refer" to "All file_lock structures that refer"

Change "The fl_next field of the lock_file structure" to "The fl_next field of the file_lock structure"

(MC)

Namhyung Kim  Dec 01, 2009 
516
6th paragraph

"F_GETBLK" should be "F_GETLK"

Note from the Author or Editor:
CONFIRMED

Change "F_GETBLK" to "F_GETLK"

(MC)

Namhyung Kim  Dec 02, 2009 
543
last paragraph (code)

"(foo_dev->intr= =1)" should be "(foo_dev->intr == 1)"

Note from the Author or Editor:
CONFIRMED

Change "(foo_dev->intr= =1)" to "(foo_dev->intr == 1)"

(MC)

Namhyung Kim  Dec 05, 2009 
543
last paragraph foo_read() function

When put_user(foo_dev->data, buf) error,it shall call up(&foo_dev->sem) before return.

ssize_t foo_read(struct file *filp, char *buf, size_t count,
loff_t *ppos)
{
foo_dev_t * foo_dev = filp->private_data;
if (down_interruptible(&foo_dev->sem)
return -ERESTARTSYS;
foo_dev->intr = 0;
outb(DEV_FOO_READ, DEV_FOO_CONTROL_PORT);
wait_event_interruptible(foo_dev->wait, (foo_dev->intr= =1));
if (put_user(foo_dev->data, buf))
return -EFAULT;
up(&foo_dev->sem);
return 1;
}


Note from the Author or Editor:
CONFIRMED

Change last four lines of block code from

if (put_user(foo_dev->data, buf))
return -EFAULT;
up(&foo_dev->sem):;
return 1;

to

if (put_user(foo_dev->data, buf)) {
up(&foo_dev->sem):;
return -EFAULT;
}
up(&foo_dev->sem):;
return 1;

Anonymous  Dec 26, 2010 
Printed
Page 571
step 4

in `bio->bi_bdev not equal to bio->bi_dev->bd_contains'
`bio->bi_dev->bd_contains'
should be
`bio->bi->bdev->bd_contains'

Note from the Author or Editor:
Change in step 4:

from "bio->bi_dev->bd_contains" to "bio->bi_bdev->bd_contains"

(MC)

mplus  Nov 25, 2014 
654
middle of the page

"The only diffence, of course, is in the second parameter" should be "... fourth parameter"

Note from the Author or Editor:
CONFIRMED

Change "the second parameter" to "the fourth parameter"

(MC)

Namhyung Kim  Dec 08, 2009 
659
2nd last paragraph

"the memory region has never accessed the third page" should be "... second page"

Note from the Author or Editor:
CONFIRMED

Change "has never accessed the third page" to "has never accessed the other page"

(MC)

Namhyung Kim  Dec 08, 2009 
670
2nd paragraph (below code)

"the iocb descriptor" should be "the kiocb descriptor"

Note from the Author or Editor:
CONFIRMED

Change "the iocb descriptor" to "the kiocb descriptor"

(MC)

Namhyung Kim  Dec 09, 2009 
687
end of the 4th paragraph

"common radix tree" should be "common radix index"

Note from the Author or Editor:
CONFIRMED

Change "common radix tree" to "common radix index"

(MC)

Namhyung Kim  Dec 11, 2009 
732
last paragraph (step 2)

"__add_to_page_cache" should be "__add_to_swap_cache"

Note from the Author or Editor:
CONFIRMED

Change "__add_to_page_cache()" to "__add_to_swap_cache()"

(MC)

Namhyung Kim  Nov 22, 2009 
733
3rd paragraph

"swapper_state" should be "swapper_space"

Note from the Author or Editor:
CONFIRMED

Change "swapper_state" to "swapper_space"

(MC)

Namhyung Kim  Nov 22, 2009 
735
step 5

"at most 2n pages" should be "at most 2^n pages"

Note from the Author or Editor:
CONFIRMED

Change "at most 2n pages" to "at most 2^n pages" (render "2^n" as
"2 powered by n")

(MC)

Namhyung Kim  Dec 15, 2009 
754
middle of the page

"as a volume consisting of 1,412 blocks" should be "... 1,440 blocks"

Note from the Author or Editor:
CONFIRMED

Change "1412 blocks" to "1440 blocks"

(MC)

Namhyung Kim  Dec 16, 2009 
Printed
Page 799
6th

The last sentence of the paragraph reads "As usual, however, the system administrator can tune these values by writing into the /proc/sys/kernel/msgmni, /proc/sys/kernel/msgmnb, and /proc/sys/kernel/msgmax files, respectively."

The last two files refered to need to be swapped. The sentence should read "As usual, however, the system administrator can tune these values by writing into the /proc/sys/kernel/msgmni, /proc/sys/kernel/msgmax, and /proc/sys/kernel/msgmnb files, respectively."

Note from the Author or Editor:
CONFIRMED

The sentence should be changed as indicated by the reader, that is changed to:

"As usual, however, the system administrator can tune these values by writing into the /proc/sys/kernel/msgmni, /proc/sys/kernel/msgmax, and /proc/sys/kernel/msgmnb files, respectively."

(MC)

Ray Michaels  Oct 28, 2009 
800
1st paragraph

"shmid_kernel" should be "msg_queue"

Note from the Author or Editor:
CONFIRMED

Change "shmid_kernel" to "msg_queue"

(MC)

Namhyung Kim  Dec 18, 2009