task_struct contains mm_struct.

If we have pid of the process then task_struct can be obtained from pid using following two methods.

1.
Please check find_task_by_pid() function in kernel. We can write a similar macro to convert pid to task_struct.

2. We can write a macro that traverses all task starting from init_task and check the required pid.

#define for_each_task(p) \
        for (p = &init_task ; (p = p->next_task) != &init_task ; )


If process is the current one then current_thread_info()->task provides task_struct for current task.
We can write a macro similar to current_thread_info().

pid-> task_struct->mm_struct.

Regards
Manoj Nayak