Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp2840816ybh; Sat, 25 Jul 2020 03:18:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwJt75G8prxAwmdZvtcmaYVOceUNeB8tkNqcMlraRqjDcjw0X35anJxnekrGY80q/fvNeGx X-Received: by 2002:a05:6402:cb9:: with SMTP id cn25mr13035191edb.247.1595672289541; Sat, 25 Jul 2020 03:18:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595672289; cv=none; d=google.com; s=arc-20160816; b=pfWo8ecQ79avgxGPw1C+tHpucFKJyJxwxYrdh8nl11RRY5cCTTT7zKzArhTA/yd9Gd QlMUNXRCRTICdKPKBZNiM5istGIFEewqZI+5KpPLEOSBThgHkRt4j/WiUixxU+hn3yKs BsB3ytFFgBSV3fcEa5QfzU98/BglZIEh56wiu08WiLtfDos4rnyZF+R6W1Bu3JM5DOug 7b4VIaz3A6aWaEXulfo2h8gyzKmfgAPG3XHo/4w2aNPc4GIf+5kXd9OHWwgOu5QdsWxc xoqyP0W4geakdu/qURGEh+th6xSVRBcumxvW4wZ9TxzHWkBW9HKkoRANAFyhurXnXCm2 9sdw== 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=b0AOSE86PGeB1I9Z9HMCGCB3b0fmc6DBmuHd8pPAROo=; b=a4qz+PO/mU3bu8aT6VV1iKw4i0edobYJWHPWmmZ65Y0OY7NdiJ5VTEv55VfrW5vNt+ R3defS6Wl1nUd9v65UuB+Ecc8h/+jvg7muuClqwAVQeOUfCnBeZ35CM0ILSolQXtlY77 HDx4bqNxkk29kD/c4p8b4QKNLFb1J6X+/rrc/Cjv0yPqEvYmoRGQ2wTg4sKxQAALPVtB eY3t8XYI3g21xCAwIfq//FZ4PPqLstBYZc77zouxFen/6/igYeOwDM+mR6+JkfAnJwpV UiDckDqRQNT9FCAFlm48ZkkFLt1hCEOimMdhJLXizLxkIcd7SDIkuKmsw4I1V4BsneAl CamA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Y++mNFQ3; 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 nv2si2162268ejb.154.2020.07.25.03.17.46; Sat, 25 Jul 2020 03:18:09 -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=Y++mNFQ3; 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 S1726658AbgGYKOz (ORCPT + 99 others); Sat, 25 Jul 2020 06:14:55 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:54524 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726618AbgGYKOz (ORCPT ); Sat, 25 Jul 2020 06:14:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1595672093; 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=b0AOSE86PGeB1I9Z9HMCGCB3b0fmc6DBmuHd8pPAROo=; b=Y++mNFQ3HrrYgRlxqSr5x4gYDeFBSX8pnpAxzpi/v/SQG884gBTS34yElOXTcrd1PC3Op1 UktxA6xzKyK/MazrAWkVMpn+U62+EM4qbBsbaDJ+Z6iGpUAWLtRe7YTLYEWWW8Lph9qKm1 ZR2jF3BXAXp2LMDmwAjiE0HI0Ve558c= 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-384-nScs2uXVMfyq-xnABE0aEg-1; Sat, 25 Jul 2020 06:14:51 -0400 X-MC-Unique: nScs2uXVMfyq-xnABE0aEg-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 289B91009600; Sat, 25 Jul 2020 10:14:50 +0000 (UTC) Received: from dhcp-27-174.brq.redhat.com (unknown [10.40.192.25]) by smtp.corp.redhat.com (Postfix) with SMTP id C482270105; Sat, 25 Jul 2020 10:14:47 +0000 (UTC) Received: by dhcp-27-174.brq.redhat.com (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Sat, 25 Jul 2020 12:14:49 +0200 (CEST) Date: Sat, 25 Jul 2020 12:14:46 +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: <20200725101445.GB3870@redhat.com> References: <20200723124749.GA7428@redhat.com> <20200724152424.GC17209@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/24, Linus Torvalds wrote: > > I just realized that one thing we could do is to not even test the > page bit for the shared case in the wakeup path. > > Because anybody who uses the non-exclusive "wait_on_page_locked()" or > "wait_on_page_writeback()" isn't actually interested in the bit state > any more at that point. All they care about is that somebody cleared > it - not whether it was then re-taken again. > > So instead of keeping them on the list - or stopping the waitqueue > walk because somebody else got the bit - we could just mark them > successfully done, wake them up, and remove those entries from the > list. Heh. I too thought about this. And just in case, your patch looks correct to me. But I can't really comment this behavioural change. Perhaps it should come in a separate patch? In essense, this partly reverts your commit 3510ca20ece0150 ("Minor page waitqueue cleanups"). I mean this part: (b) we don't want to put the non-locking waiters always on the front of the queue, and the locking waiters always on the back. Not only is that unfair, it means that we wake up thousands of reading threads that will just end up being blocked by the writer later anyway. ... @@ -972,10 +976,7 @@ static inline int wait_on_page_bit_common(wait_queue_head_t *q, spin_lock_irq(&q->lock); if (likely(list_empty(&wait->entry))) { - if (lock) - __add_wait_queue_entry_tail_exclusive(q, wait); - else - __add_wait_queue(q, wait); + __add_wait_queue_entry_tail(q, wait); SetPageWaiters(page); } Oleg.