linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Oleksandr Natalenko <oleksandr@natalenko.name>
To: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Mike Galbraith <efault@gmx.de>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	Andrew Morton <akpm@linux-foundation.org>,
	Steven Rostedt <rostedt@goodmis.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	linux-rt-users@vger.kernel.org
Subject: Re: scheduling while atomic in z3fold
Date: Mon, 30 Nov 2020 14:53:22 +0100	[thread overview]
Message-ID: <20201130135322.zi7moa57ajbdvfpy@spock.localdomain> (raw)
In-Reply-To: <20201130132014.mlvxeyiub3fpwyw7@linutronix.de>

On Mon, Nov 30, 2020 at 02:20:14PM +0100, Sebastian Andrzej Siewior wrote:
> On 2020-11-29 12:41:14 [+0100], Mike Galbraith wrote:
> > On Sun, 2020-11-29 at 12:29 +0100, Oleksandr Natalenko wrote:
> > >
> > > Ummm so do compressors explode under non-rt kernel in your tests as
> > > well, or it is just -rt that triggers this?
> > 
> > I only tested a non-rt kernel with z3fold, which worked just fine.
> 
> I tried this and it did not not explode yet. Mike, can you please
> confirm?
> 
> diff --git a/mm/z3fold.c b/mm/z3fold.c
> index 18feaa0bc5377..0bf70f624a4bd 100644
> --- a/mm/z3fold.c
> +++ b/mm/z3fold.c
> @@ -642,14 +642,17 @@ static inline void add_to_unbuddied(struct z3fold_pool *pool,
>  {
>  	if (zhdr->first_chunks == 0 || zhdr->last_chunks == 0 ||
>  			zhdr->middle_chunks == 0) {
> -		struct list_head *unbuddied = get_cpu_ptr(pool->unbuddied);
> -
> +		struct list_head *unbuddied;
>  		int freechunks = num_free_chunks(zhdr);
> +
> +		migrate_disable();
> +		unbuddied = this_cpu_ptr(pool->unbuddied);
> +
>  		spin_lock(&pool->lock);
>  		list_add(&zhdr->buddy, &unbuddied[freechunks]);
>  		spin_unlock(&pool->lock);
>  		zhdr->cpu = smp_processor_id();
> -		put_cpu_ptr(pool->unbuddied);
> +		migrate_enable();
>  	}
>  }
>  
> @@ -887,7 +890,8 @@ static inline struct z3fold_header *__z3fold_alloc(struct z3fold_pool *pool,
>  
>  lookup:
>  	/* First, try to find an unbuddied z3fold page. */
> -	unbuddied = get_cpu_ptr(pool->unbuddied);
> +	migrate_disable();
> +	unbuddied = this_cpu_ptr(pool->unbuddied);
>  	for_each_unbuddied_list(i, chunks) {
>  		struct list_head *l = &unbuddied[i];
>  
> @@ -905,7 +909,7 @@ static inline struct z3fold_header *__z3fold_alloc(struct z3fold_pool *pool,
>  		    !z3fold_page_trylock(zhdr)) {
>  			spin_unlock(&pool->lock);
>  			zhdr = NULL;
> -			put_cpu_ptr(pool->unbuddied);
> +			migrate_enable();
>  			if (can_sleep)
>  				cond_resched();
>  			goto lookup;
> @@ -919,7 +923,7 @@ static inline struct z3fold_header *__z3fold_alloc(struct z3fold_pool *pool,
>  		    test_bit(PAGE_CLAIMED, &page->private)) {
>  			z3fold_page_unlock(zhdr);
>  			zhdr = NULL;
> -			put_cpu_ptr(pool->unbuddied);
> +			migrate_enable();
>  			if (can_sleep)
>  				cond_resched();
>  			goto lookup;
> @@ -934,7 +938,7 @@ static inline struct z3fold_header *__z3fold_alloc(struct z3fold_pool *pool,
>  		kref_get(&zhdr->refcount);
>  		break;
>  	}
> -	put_cpu_ptr(pool->unbuddied);
> +	migrate_enable();
>  
>  	if (!zhdr) {
>  		int cpu;
> diff --git a/mm/zswap.c b/mm/zswap.c
> index 78a20f7b00f2c..b24f761b9241c 100644
> --- a/mm/zswap.c
> +++ b/mm/zswap.c
> @@ -394,7 +394,9 @@ struct zswap_comp {
>  	u8 *dstmem;
>  };
>  
> -static DEFINE_PER_CPU(struct zswap_comp, zswap_comp);
> +static DEFINE_PER_CPU(struct zswap_comp, zswap_comp) = {
> +	.lock = INIT_LOCAL_LOCK(lock),

Is it a residue?

> +};
>  
>  static int zswap_dstmem_prepare(unsigned int cpu)
>  {
> 
> > 	-Mike
> 
> Sebastian

-- 
  Oleksandr Natalenko (post-factum)


  reply	other threads:[~2020-11-30 13:53 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-28 14:05 Oleksandr Natalenko
2020-11-28 14:09 ` Oleksandr Natalenko
2020-11-28 14:27   ` Oleksandr Natalenko
2020-11-29  6:41     ` Mike Galbraith
     [not found]       ` <79ee43026efe5aaa560953ea8fe29a826ac4e855.camel@gmx.de>
2020-11-29  9:21         ` Mike Galbraith
2020-11-29 10:56           ` Mike Galbraith
2020-11-29 11:29             ` Oleksandr Natalenko
2020-11-29 11:41               ` Mike Galbraith
2020-11-30 13:20                 ` Sebastian Andrzej Siewior
2020-11-30 13:53                   ` Oleksandr Natalenko [this message]
2020-11-30 14:28                     ` Sebastian Andrzej Siewior
2020-11-30 14:42                   ` Mike Galbraith
2020-11-30 14:52                     ` Sebastian Andrzej Siewior
2020-11-30 15:01                       ` Mike Galbraith
2020-11-30 15:03                         ` Mike Galbraith
2020-11-30 16:03                         ` Sebastian Andrzej Siewior
2020-11-30 16:27                           ` Mike Galbraith
2020-11-30 16:32                             ` Sebastian Andrzej Siewior
2020-11-30 16:36                               ` Mike Galbraith
2020-11-30 19:09                               ` Mike Galbraith
2020-11-30 16:53                             ` Mike Galbraith
2020-12-02  2:30                           ` Mike Galbraith
     [not found]                             ` <20201202220826.5chy56mbgvrwmg3d@linutronix.de>
2020-12-03  2:16                               ` Mike Galbraith
2020-12-03  8:18                                 ` Mike Galbraith
2020-12-03 13:39                                   ` Sebastian Andrzej Siewior
2020-12-03 14:07                                     ` Vitaly Wool
2020-12-06  9:18                                     ` Mike Galbraith
2020-12-07  1:05                                       ` Vitaly Wool
2020-12-07  2:18                                         ` Mike Galbraith
2020-12-07 11:52                                           ` Vitaly Wool
2020-12-07 12:34                                             ` Mike Galbraith
2020-12-07 15:21                                               ` Vitaly Wool
2020-12-07 15:41                                                 ` Sebastian Andrzej Siewior
2020-12-07 15:41                                                 ` Mike Galbraith
2020-12-08 23:26                                                   ` Vitaly Wool
2020-12-09  6:13                                                     ` Mike Galbraith
2020-12-09  6:31                                                       ` Mike Galbraith

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201130135322.zi7moa57ajbdvfpy@spock.localdomain \
    --to=oleksandr@natalenko.name \
    --cc=akpm@linux-foundation.org \
    --cc=bigeasy@linutronix.de \
    --cc=efault@gmx.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox