[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200724144525.GB17209@redhat.com>
Date: Fri, 24 Jul 2020 16:45:25 +0200
From: Oleg Nesterov <oleg@...hat.com>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Hugh Dickins <hughd@...gle.com>, Michal Hocko <mhocko@...nel.org>,
Linux-MM <linux-mm@...ck.org>,
LKML <linux-kernel@...r.kernel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Tim Chen <tim.c.chen@...ux.intel.com>,
Michal Hocko <mhocko@...e.com>
Subject: Re: [RFC PATCH] mm: silence soft lockups from unlock_page
On 07/23, Linus Torvalds wrote:
>
> IOW, I think we should do something like this (this is on top of my
> patch, since it has that wake_page_function() change in it, but notice
> how we have the exact same issue in our traditional
> autoremove_wake_function() usage).
...
> +static inline void list_del_init_careful(struct list_head *entry)
> +{
> + __list_del_entry(entry);
> + entry->prev = entry;
> + smp_store_release(&entry->next, entry);
> +}
> +
...
> static inline int list_empty_careful(const struct list_head *head)
> {
> - struct list_head *next = head->next;
> + struct list_head *next = smp_load_acquire(&head->next);
> return (next == head) && (next == head->prev);
> }
This (and your previous email) answers my concerns about memory barriers.
IIUC, finish_wait() could even use this version of list_empty_careful(),
struct list_head *next = smp_load_acquire(&head->next);
return (next == head) && !WARN_ON(next != head->prev);
iow, it doesn't really need to check next == head->prev as long as only
list_del_init_careful() can remove it from list.
Thanks!
Oleg.
Powered by blists - more mailing lists