From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.6 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 57618C433E5 for ; Fri, 24 Jul 2020 14:45:37 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id F210B2064B for ; Fri, 24 Jul 2020 14:45:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="NDuePlci" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F210B2064B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 54A598D0013; Fri, 24 Jul 2020 10:45:36 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4FC2B8D0001; Fri, 24 Jul 2020 10:45:36 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 411448D0013; Fri, 24 Jul 2020 10:45:36 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0147.hostedemail.com [216.40.44.147]) by kanga.kvack.org (Postfix) with ESMTP id 2BEA08D0001 for ; Fri, 24 Jul 2020 10:45:36 -0400 (EDT) Received: from smtpin28.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id B44998248068 for ; Fri, 24 Jul 2020 14:45:35 +0000 (UTC) X-FDA: 77073243030.28.grass31_270c20126f48 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin28.hostedemail.com (Postfix) with ESMTP id 8EB1B1690D for ; Fri, 24 Jul 2020 14:45:35 +0000 (UTC) X-HE-Tag: grass31_270c20126f48 X-Filterd-Recvd-Size: 4110 Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by imf17.hostedemail.com (Postfix) with ESMTP for ; Fri, 24 Jul 2020 14:45:34 +0000 (UTC) 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 X-Rspamd-Queue-Id: 8EB1B1690D X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam05 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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.