Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp2234595ybh; Fri, 24 Jul 2020 07:46:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyesshMI9ssu2K1/EL86NQSqkTfESFn7S/qYT0+fLJSzLEdKRpezEJnyXrOXdmNZagyydFM X-Received: by 2002:a17:906:4c48:: with SMTP id d8mr9113194ejw.331.1595601980178; Fri, 24 Jul 2020 07:46:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595601980; cv=none; d=google.com; s=arc-20160816; b=UcO2TenR1Nbvowc2SOTBDMC+ZsJauQc+9QvH4nTtnfV0FYdRAsdrXOGY7X/6acyxBa KhY5sGGHsmCo2RpBtJYtke6mu6yAB/GBkicX26bAcJD72OayxqOrtyAggOEWN3EMOcqR cmQtUBX9GxZHdBaxzsgnFEKW2/EqAnPIVFeNQ3UbmkT7ANHtcTsaK1jRCVPdQ4Uv9Odf LJ5W+i83igeIE0/eGLMfKOtCTpbEwG+xklRh+RI7gJbrpIxjWVTzq+Zh9ay0vyW+2cnw Nf6fJCnYaFh0RH/x2wIzMKtSPRfRF9nICUrcLicdB3DtdohZbf4gRRtEmOXhBPaglfN/ PQ6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=bG1yDLGWaSETMRzgJW6YtgsTeF47PRE999wzG6k/f94=; b=NIrNR/BTVaF+qLhayf6UG94TwDkBojd9Vh3lQGqOGg0XU1R6dXOx7hIe/bF4aXvER2 ItEqHvxT0pqOchDJAs6zJra5Gjzg0tA1OOG7vU/Y4jrmZYgTKk2cREo0FsLkbnEbDDEJ z0yp4U4wHt9x9OyKZO3/R2h4CaD7vet1RjC/cEVTwIjFnvidlzParz7SK7HMDs9kGBNk woZboVVlq2FUFhgyOd/NWgLZhL7COJ5/q9p7G83SZuymyFn9QqW8olc2XG668q9po1Rh iZv2WomwouHU9+VBuvVDmGo9PKMyoOvowNxk0kSYRTjDBzLifhykSiP8MGD7xXKRqnOr wl5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=NDuePlci; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h25si643234edv.231.2020.07.24.07.45.56; Fri, 24 Jul 2020 07:46:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=NDuePlci; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726651AbgGXOpg (ORCPT + 99 others); Fri, 24 Jul 2020 10:45:36 -0400 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:33222 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726170AbgGXOpf (ORCPT ); Fri, 24 Jul 2020 10:45:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1595601934; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=bG1yDLGWaSETMRzgJW6YtgsTeF47PRE999wzG6k/f94=; b=NDuePlcin5he6w9SHzhaA+q9+VPnapy1+uQH4ZZbgC7vOLANauJOHGLYEzgymgdFkNr+Oz 89ngWXdhR3b5ofnOBoASKLeN0V1mlqdIq28qr3QmmsJhBeSqmQOLjMM8dcrOO5T/hV8IgQ rY3xPLXskYm+3RJ26aIhN2OF3oACkt4= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-150-wyDAzewePwaS7ZvCwK9RoQ-1; Fri, 24 Jul 2020 10:45:30 -0400 X-MC-Unique: wyDAzewePwaS7ZvCwK9RoQ-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id EE98080183C; Fri, 24 Jul 2020 14:45:28 +0000 (UTC) Received: from dhcp-27-174.brq.redhat.com (unknown [10.40.192.121]) by smtp.corp.redhat.com (Postfix) with SMTP id E524370C5F; Fri, 24 Jul 2020 14:45:26 +0000 (UTC) Received: by dhcp-27-174.brq.redhat.com (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Fri, 24 Jul 2020 16:45:28 +0200 (CEST) Date: Fri, 24 Jul 2020 16:45:25 +0200 From: Oleg Nesterov To: Linus Torvalds Cc: Hugh Dickins , Michal Hocko , Linux-MM , LKML , Andrew Morton , Tim Chen , Michal Hocko Subject: Re: [RFC PATCH] mm: silence soft lockups from unlock_page Message-ID: <20200724144525.GB17209@redhat.com> References: <20200723124749.GA7428@redhat.com> <20200723180100.GA21755@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.