函数源码

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source File:include\linux\sched\mm.h Create Date:2022-07-27 06:42:44
首页 Copyright©Brick

143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
#else
static inline void arch_pick_mmap_layout(struct mm_struct *mm,
                     struct rlimit *rlim_stack) {}
#endif
 
static inline bool in_vfork(struct task_struct *tsk)
{
    bool ret;
 
    /*
     * need RCU to access ->real_parent if CLONE_VM was used along with
     * CLONE_PARENT.
     *
     * We check real_parent->mm == tsk->mm because CLONE_VFORK does not
     * imply CLONE_VM
     *
     * CLONE_VFORK can be used with CLONE_PARENT/CLONE_THREAD and thus
     * ->real_parent is not necessarily the task doing vfork(), so in
     * theory we can't rely on task_lock() if we want to dereference it.
     *
     * And in this case we can't trust the real_parent->mm == tsk->mm
     * check, it can be false negative. But we do not care, if init or
     * another oom-unkillable task does this it should blame itself.
     */
    rcu_read_lock();
    ret = tsk->vfork_done && tsk->real_parent->mm == tsk->mm;
    rcu_read_unlock();
 
    return ret;
}