linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [Question] Dead code in copy_pud_range() for copy_huge_pud() error check?
@ 2026-01-31 17:28 Ingyu Jang
  2026-02-02 15:28 ` Joshua Hahn
  2026-02-02 15:40 ` David Hildenbrand (arm)
  0 siblings, 2 replies; 5+ messages in thread
From: Ingyu Jang @ 2026-01-31 17:28 UTC (permalink / raw)
  To: linux-mm; +Cc: akpm, david, Ingyu Jang

Hi,

I noticed that in mm/memory.c, the function copy_pud_range() checks
if copy_huge_pud() returns -ENOMEM (at line 1421):

    err = copy_huge_pud(dst_mm, src_mm,
                        dst_pud, src_pud, addr, src_vma);
    if (err == -ENOMEM)
        return -ENOMEM;

However, looking at copy_huge_pud() in mm/huge_memory.c (line 1966),
it only returns two values:
  - 0 on success (line 1994)
  - -EAGAIN when !pud_trans_huge(pud) (line 1978)

There is no code path that returns -ENOMEM, which means the check
"if (err == -ENOMEM)" at line 1421 is unreachable dead code.

Is this intentional defensive coding for potential future changes,
or could this unreachable error check be cleaned up?

Thanks,
Ingyu Jang


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-02-02 15:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-01-31 17:28 [Question] Dead code in copy_pud_range() for copy_huge_pud() error check? Ingyu Jang
2026-02-02 15:28 ` Joshua Hahn
2026-02-02 15:37   ` Matthew Wilcox
2026-02-02 15:50     ` Joshua Hahn
2026-02-02 15:40 ` David Hildenbrand (arm)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox