Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

procfs: task_diag: remove unused computation (nice/priority) in TASK_… #1

Closed
wants to merge 24 commits into from

Commits on Nov 15, 2018

  1. kernel: define taststats commands in the one place

    Currently if we add a new TASKSTATS_ constant, we will chanage all
    CGROUPSTATS_ contants and break backward compatibility.
    
    Signed-off-by: Andrey Vagin <avagin@openvz.org>
    avagin committed Nov 15, 2018
    Configuration menu
    Copy the full SHA
    2034548 View commit details
    Browse the repository at this point in the history
  2. 0000-RFC-kernel-add-a-netlink-interface-to-get-informatio.patch

    Signed-off-by: Andrey Vagin <avagin@openvz.org>
    avagin committed Nov 15, 2018
    Configuration menu
    Copy the full SHA
    3021623 View commit details
    Browse the repository at this point in the history
  3. proc: pick out a function to iterate task children

    This function will be used in task_diag.
    
    Signed-off-by: Andrey Vagin <avagin@openvz.org>
    avagin committed Nov 15, 2018
    Configuration menu
    Copy the full SHA
    54a4b0a View commit details
    Browse the repository at this point in the history
  4. proc: export task_first_tid() and task_next_tid()

    It will be more convenient when this function will be used in
    task_diag.
    
    Signed-off-by: Andrey Vagin <avagin@openvz.org>
    avagin committed Nov 15, 2018
    Configuration menu
    Copy the full SHA
    9ab685b View commit details
    Browse the repository at this point in the history
  5. proc: export next_tgid()

    It's going to be used in task_diag
    avagin committed Nov 15, 2018
    Configuration menu
    Copy the full SHA
    f35d392 View commit details
    Browse the repository at this point in the history
  6. task_diag: add a new interface to get information about tasks (v4)

    The task-diag interface allows to get information about running
    processes (roughly same info that is now available from /proc/PID/*
    files). Compared to /proc/PID/*, it is faster, more flexible and
    provides data in a binary format.
    
    Task-diag was created using the basic idea of socket_diag.
    
    Here is the /proc/task-diag file, which operates based on the following
    principles:
    
    * Transactional: write request, read response
    * Netlink message format (same as used by sock_diag; binary and extendable)
    
    A request messages is described by the task_diag_pid structure:
    struct task_diag_pid {
    	__u64   show_flags;
    	__u64   dump_strategy;
    
    	__u32   pid;
    };
    
    A respone is a set of netlink messages. Each message describes one task.
    All task properties are divided on groups. A message contains the
    TASK_DIAG_PID group, and other groups if they have been requested in
    show_flags. For example, if show_flags contains TASK_DIAG_SHOW_BASE, a
    response will contain the TASK_DIAG_CRED group which is described by the
    task_diag_creds structure.
    
    struct task_diag_base {
    	__u32   tgid;
    	__u32   pid;
    	__u32   ppid;
    	__u32   tpid;
    	__u32   sid;
    	__u32   pgid;
    	__u8    state;
    	char    comm[TASK_DIAG_COMM_LEN];
    };
    
    The dump_strategy field will be used in following patches to request
    information for a group of processes.
    
    v2: A few changes from David Ahern
        Use a consistent name
        Add max attr enum
        task diag: Send pid as u32
        Change _MSG/msg references to base
        Fix 8-byte alignment
    
    v3: take pid namespace from scm credentials. There is a pid of a process
    which sent an request. If we need to get information from another
    namespace, we can set pid in scm of a process from this namespaces.
    
    v4: use a transaction file instead of netlink
    
    Cc: David Ahern <dsahern@gmail.com>
    Signed-off-by: Andrey Vagin <avagin@openvz.org>
    avagin committed Nov 15, 2018
    Configuration menu
    Copy the full SHA
    dacb1e2 View commit details
    Browse the repository at this point in the history
  7. task_diag: add a new group to get process credentials

    A response is represented by the task_diag_creds structure:
    
    struct task_diag_creds {
       struct task_diag_caps cap_inheritable;
       struct task_diag_caps cap_permitted;
       struct task_diag_caps cap_effective;
       struct task_diag_caps cap_bset;
    
       __u32 uid;
       __u32 euid;
       __u32 suid;
       __u32 fsuid;
       __u32 gid;
       __u32 egid;
       __u32 sgid;
       __u32 fsgid;
    };
    
    This group is optional and it's filled only if show_flags contains
    TASK_DIAG_SHOW_CRED.
    
    Signed-off-by: Andrey Vagin <avagin@openvz.org>
    avagin committed Nov 15, 2018
    Configuration menu
    Copy the full SHA
    497d76e View commit details
    Browse the repository at this point in the history
  8. task_diag: add a new group to get tasks memory mappings (v2)

    v2: Fixes from David Ahern
    * Fix 8-byte alignment
    * Change implementation of DIAG_VMA attribute:
    
    This patch puts the filename into the task_diag_vma struct and
    converts TASK_DIAG_VMA attribute into a series of task_diag_vma.
    Now is there is a single TASK_DIAG_VMA attribute that is parsed
    as:
    
    | struct task_diag_vma | filename | ...
    
    Cc: David Ahern <dsahern@gmail.com>
    Signed-off-by: Andrey Vagin <avagin@openvz.org>
    avagin committed Nov 15, 2018
    Configuration menu
    Copy the full SHA
    0537af3 View commit details
    Browse the repository at this point in the history
  9. task_diag: add ability to dump children and threads

    Now we can dump all task or children, threads of a specified task.
    It's an example how this interface can be expanded for different
    use-cases.
    
    v2: Fixes from David Ahern
    Add missing break in iter_stop
    Fix 8-byte alignment issues
    
    Cc: David Ahern <dsahern@gmail.com>
    Signed-off-by: Andrey Vagin <avagin@openvz.org>
    avagin committed Nov 15, 2018
    Configuration menu
    Copy the full SHA
    f397981 View commit details
    Browse the repository at this point in the history
  10. task_diag: Only add VMAs for thread_group leader

    threads of a process share the same VMAs, so when dumping all threads
    for all processes only push vma data for group leader.
    
    Signed-off-by: David Ahern <dsahern@gmail.com>
    Signed-off-by: Andrey Vagin <avagin@openvz.org>
    dsahern authored and avagin committed Nov 15, 2018
    Configuration menu
    Copy the full SHA
    81f8f74 View commit details
    Browse the repository at this point in the history
  11. task_diag: add a flag to mark incomplete messages

    If all information about a process don't fit in a message, it's marked
    by the TASK_DIAG_FLAG_CONT flag and the next message will describe the
    same process.
    avagin committed Nov 15, 2018
    Configuration menu
    Copy the full SHA
    f5fd07a View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    1e64ecb View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    f12091b View commit details
    Browse the repository at this point in the history
  14. Documentation: add documentation for task_diag

    Signed-off-by: Andrey Vagin <avagin@openvz.org>
    avagin committed Nov 15, 2018
    Configuration menu
    Copy the full SHA
    17c4ac9 View commit details
    Browse the repository at this point in the history
  15. selftest: check the task_diag functinonality

    Here are two test (example) programs.
    
    task_diag - request information for two processes.
    test_diag_all - request information about all processes
    
    v2: Fixes from David Ahern:
        * task_diag: Fix 8-byte alignment for vma and vma_stats
    
    Signed-off-by: Andrey Vagin <avagin@openvz.org>
    avagin committed Nov 15, 2018
    Configuration menu
    Copy the full SHA
    7d43b87 View commit details
    Browse the repository at this point in the history
  16. task_diag: Enhance fork tool to spawn threads

    Add option to fork threads as well as processes.
    Make the sleep time configurable too so that spawned
    tasks exit on their own.
    
    Signed-off-by: David Ahern <dsahern@gmail.com>
    Signed-off-by: Andrey Vagin <avagin@openvz.org>
    dsahern authored and avagin committed Nov 15, 2018
    Configuration menu
    Copy the full SHA
    a7daa55 View commit details
    Browse the repository at this point in the history
  17. Configuration menu
    Copy the full SHA
    fd56a8d View commit details
    Browse the repository at this point in the history
  18. task_diag: show cmdline

    avagin committed Nov 15, 2018
    Configuration menu
    Copy the full SHA
    c788196 View commit details
    Browse the repository at this point in the history
  19. Configuration menu
    Copy the full SHA
    191db8e View commit details
    Browse the repository at this point in the history
  20. Configuration menu
    Copy the full SHA
    4c3b342 View commit details
    Browse the repository at this point in the history
  21. task_next_child() s/unsigned int pos/loff_t pos

    pos should be loff_t type. It's might be fine to truncate it
    to unsigned int in this case, but it's better not to.
    E.g. see 9f6e963 ("proc: fix ->f_pos overflows in first_tid()")
    
    Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
    aryabinin authored and avagin committed Nov 15, 2018
    Configuration menu
    Copy the full SHA
    3b61077 View commit details
    Browse the repository at this point in the history
  22. task_diag: use proper loff_t type for pos.

    Just to be safe. If truncation to unsigned int is fine it should be a
    separate patch
    
    Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
    aryabinin authored and avagin committed Nov 15, 2018
    Configuration menu
    Copy the full SHA
    014f2ff View commit details
    Browse the repository at this point in the history
  23. selftest/task_diag: Add TASK_DIAG_SHOW_STAT test.

    Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
    aryabinin authored and avagin committed Nov 15, 2018
    Configuration menu
    Copy the full SHA
    2a9e0ea View commit details
    Browse the repository at this point in the history

Commits on Jul 22, 2019

  1. procfs: task_diag: remove unused computation (nice/priority) in TASK_…

    …DIAG_STAT
    
    nice and priority are computed but not used.
    
    Signe-off-by: Marc Titinger <marc.titinger@magnetimarelli.com>
    mtitinger authored Jul 22, 2019
    Configuration menu
    Copy the full SHA
    2caa530 View commit details
    Browse the repository at this point in the history