• Mike Kravetz's avatar
    hugetlb: make free_huge_page irq safe · db71ef79
    Mike Kravetz authored
    Commit c77c0a8a ("mm/hugetlb: defer freeing of huge pages if in
    non-task context") was added to address the issue of free_huge_page being
    called from irq context.  That commit hands off free_huge_page processing
    to a workqueue if !in_task.  However, this doesn't cover all the cases as
    pointed out by 0day bot lockdep report [1].
    
    :  Possible interrupt unsafe locking scenario:
    :
    :        CPU0                    CPU1
    :        ----                    ----
    :   lock(hugetlb_lock);
    :                                local_irq_disable();
    :                                lock(slock-AF_INET);
    :                                lock(hugetlb_lock);
    :   <Interrupt>
    :     lock(slock-AF_INET);
    
    Shakeel has later explained that this is very likely TCP TX zerocopy from
    hugetlb pages scenario when the networking code drops a last reference to
    hugetlb page while having IRQ disabled.  Hugetlb freeing path doesn't
    disable IRQ while holding hugetlb_lock so a lock dependency chain can lead
    ...
    db71ef79
hugetlb_cgroup.c 21.5 KB