Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1740817

Re: [PATCH v2 1/2] pid: Replace pid bitmap implementation with IDR API

From Oleg Nesterov <oleg@redhat.com>
Newsgroups linux.kernel
Subject Re: [PATCH v2 1/2] pid: Replace pid bitmap implementation with IDR API
Date 2017-09-27 17:10 +0200
Message-ID <uum8m-4P4-83@gated-at.bofh.it> (permalink)
References <uucLD-6o3-3@gated-at.bofh.it> <uucLD-6o3-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 09/27, Gargi Sharma wrote:
>
> @@ -309,7 +168,22 @@ struct pid *alloc_pid(struct pid_namespace *ns)
>  	tmp = ns;
>  	pid->level = ns->level;
>  	for (i = ns->level; i >= 0; i--) {
> -		nr = alloc_pidmap(tmp);
> +		int pid_min = 1;
> +		idr_preload(GFP_KERNEL);
> +		spin_lock_irq(&pidmap_lock);
> +
> +		/*
> +		 * init really needs pid 1, but after reaching the maximum
> +		 * wrap back to RESERVED_PIDS
> +		 */
> +		if (tmp->idr.idr_next > RESERVED_PIDS)
> +			pid_min = RESERVED_PIDS;
> +
> +		nr = idr_alloc_cyclic(&tmp->idr, pid, pid_min,
> +				      pid_max, GFP_ATOMIC);
> +		spin_unlock_irq(&pidmap_lock);
> +		idr_preload_end();
> +
>  		if (nr < 0) {
>  			retval = nr;
>  			goto out_free;
> @@ -346,12 +220,14 @@ struct pid *alloc_pid(struct pid_namespace *ns)
>  	return pid;
>  
>  out_unlock:
> -	spin_unlock_irq(&pidmap_lock);
>  	put_pid_ns(ns);
> +	spin_unlock_irq(&pidmap_lock);

Why? No need to move put_pid_ns() under pidmap_lock, please remove this change...

>  void __init pidhash_init(void)
>  {
> +	unsigned int pidhash_size;
> +
>  	pid_hash = alloc_large_system_hash("PID", sizeof(*pid_hash), 0, 18,
>  					   HASH_EARLY | HASH_SMALL | HASH_ZERO,
>  					   &pidhash_shift, NULL,
>  					   0, 4096);
> +	pidhash_size = 1U << pidhash_shift;
>  }

Hmm, this change makes no sense. And the next patch kills pidhash_init()
altogether.

Oleg.

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2 0/2] Replace PID bitmap allocation with IDR API Gargi Sharma <gs051095@gmail.com> - 2017-09-27 07:10 +0200
  [PATCH v2 1/2] pid: Replace pid bitmap implementation with IDR API Gargi Sharma <gs051095@gmail.com> - 2017-09-27 07:10 +0200
    Re: [PATCH v2 1/2] pid: Replace pid bitmap implementation with IDR  API Rik van Riel <riel@surriel.com> - 2017-09-27 15:20 +0200
      Re: [PATCH v2 1/2] pid: Replace pid bitmap implementation with IDR  API Oleg Nesterov <oleg@redhat.com> - 2017-09-27 16:10 +0200
        Re: [PATCH v2 1/2] pid: Replace pid bitmap implementation with IDR API Gargi Sharma <gs051095@gmail.com> - 2017-09-27 17:10 +0200
          Re: [PATCH v2 1/2] pid: Replace pid bitmap implementation with IDR  API Oleg Nesterov <oleg@redhat.com> - 2017-09-27 17:20 +0200
      Re: [PATCH v2 1/2] pid: Replace pid bitmap implementation with IDR API Gargi Sharma <gs051095@gmail.com> - 2017-09-27 17:10 +0200
    Re: [PATCH v2 1/2] pid: Replace pid bitmap implementation with IDR  API Oleg Nesterov <oleg@redhat.com> - 2017-09-27 17:10 +0200
    Re: [PATCH v2 1/2] pid: Replace pid bitmap implementation with IDR  API Christoph Hellwig <hch@infradead.org> - 2017-10-01 11:20 +0200
      Re: [PATCH v2 1/2] pid: Replace pid bitmap implementation with IDR API Gargi Sharma <gs051095@gmail.com> - 2017-10-01 12:40 +0200
        Re: [PATCH v2 1/2] pid: Replace pid bitmap implementation with IDR  API Rik van Riel <riel@surriel.com> - 2017-10-02 15:20 +0200
      Re: [PATCH v2 1/2] pid: Replace pid bitmap implementation with IDR  API Rik van Riel <riel@surriel.com> - 2017-10-02 15:10 +0200
  [PATCH v2 2/2] pid: Remove pidhash Gargi Sharma <gs051095@gmail.com> - 2017-09-27 07:10 +0200
    Re: [PATCH v2 2/2] pid: Remove pidhash Oleg Nesterov <oleg@redhat.com> - 2017-09-27 17:50 +0200
      Re: [PATCH v2 2/2] pid: Remove pidhash Oleg Nesterov <oleg@redhat.com> - 2017-09-27 18:30 +0200
        Re: [PATCH v2 2/2] pid: Remove pidhash Gargi Sharma <gs051095@gmail.com> - 2017-09-30 17:50 +0200
      Re: [PATCH v2 2/2] pid: Remove pidhash Rik van Riel <riel@surriel.com> - 2017-10-02 22:50 +0200
        Re: [PATCH v2 2/2] pid: Remove pidhash Gargi Sharma <gs051095@gmail.com> - 2017-10-02 22:50 +0200
      Re: [PATCH v2 2/2] pid: Remove pidhash Oleg Nesterov <oleg@redhat.com> - 2017-10-02 22:50 +0200
      Re: [PATCH v2 2/2] pid: Remove pidhash Rik van Riel <riel@surriel.com> - 2017-10-02 22:50 +0200
  Re: [PATCH v2 0/2] Replace PID bitmap allocation with IDR API ebiederm@xmission.com (Eric W. Biederman) - 2017-09-27 19:20 +0200
    Re: [PATCH v2 0/2] Replace PID bitmap allocation with IDR API Rik van Riel <riel@surriel.com> - 2017-09-28 21:50 +0200
      Re: [PATCH v2 0/2] Replace PID bitmap allocation with IDR API Gargi Sharma <gs051095@gmail.com> - 2017-09-28 22:10 +0200
        Re: [PATCH v2 0/2] Replace PID bitmap allocation with IDR API Rik van Riel <riel@surriel.com> - 2017-09-29 02:40 +0200

csiph-web