Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1487255imu; Tue, 20 Nov 2018 19:21:52 -0800 (PST) X-Google-Smtp-Source: AFSGD/WFaJntJGZBCxC6l1VOn9s3ueu6KjE3SmMiNUVCUG7/9xlH7m+N06Kt0ercrHfvwM+FEzn1 X-Received: by 2002:a63:8043:: with SMTP id j64mr4464148pgd.405.1542770512340; Tue, 20 Nov 2018 19:21:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542770512; cv=none; d=google.com; s=arc-20160816; b=tE6fIYgcfvbhrvk+rgo/595/S7ROc8GOziuuuhE/lK6B8kBsmsjf4mKiuChD3S0Wme gvCfHdJNQZNltsCwtgHEsuMChl/BSdWWxGWPvcG/nJwoijgqSddTv/SqU9aYa9hnJRSm PCGOHK1wG3vNbVvaM0niWfxrsCM1tDPm7y1cjiBmXyjRsfVfcZ/YEidDflxlh4rHh27A glktqM26lfiulbgQ9MD08o7QTz6Vlpm3Lbcn92Sq+kTrAnthpdHgFNVq1/HSxGeZEPfP mRcQguG57iPrIES5/hqJSMhMkmTwNC41xaJsKOJIJtapN5h8J8Icz9Y/O5YT9YWBpNkT ORpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date:dkim-signature; bh=TZ1ILf36vluQRmD7+XUbNoBKgZDQAlA/hXOW/yYPvow=; b=Q5xkLjq6dzsscFGNA990720jvguM5Snmprd7vc0g6h6qkhm8ByYC0vqIQbNzRgEz2d e9iyBjn7dZv8LT9tZGO7C5OZPqvT090ChVXPBpJQavhJPyalQ8HfL4sm5dSLUq/enIsa OkiJvGLU0kzUMe1ZENxOn9fQ19DmrOKo8PE+8Zx5PyVlJFQ6jkfJ54Pen3Tu+ItN2isN td4vHnzd8m5wWXEWxVBUh8/FRbF4sB+ItBLI3n+fCqwRdA3T4+plZY983m2UdcV1xysH 4yS9iMT2zc4jXVPSBB2//CgjY+1LvyDd2n0yT8hBCdVzKvquhwcfq88UStKfB57/cPyJ BMmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=hMdTlTN0; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s8si8707636plq.345.2018.11.20.19.21.37; Tue, 20 Nov 2018 19:21:52 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=hMdTlTN0; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727223AbeKUNxU (ORCPT + 99 others); Wed, 21 Nov 2018 08:53:20 -0500 Received: from mail-pl1-f174.google.com ([209.85.214.174]:43893 "EHLO mail-pl1-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726483AbeKUNxT (ORCPT ); Wed, 21 Nov 2018 08:53:19 -0500 Received: by mail-pl1-f174.google.com with SMTP id gn14so3323470plb.10 for ; Tue, 20 Nov 2018 19:20:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=TZ1ILf36vluQRmD7+XUbNoBKgZDQAlA/hXOW/yYPvow=; b=hMdTlTN02M98lXyk7Ucwpt/RH5xmd+8WA/v/Jt3jTrFs0BJiYCEs05ZeW0x2farKNt Fd9C1DnZz+vZWHT8b2wmBMRfg8WMCjq+fzFMcVic5v/O/wcZVCUgtKO2oj6vJ1pVZv4b e3LibR8BfHSjVFWDxJ7n/xJDXTUwmJYxoOf/hEXGhGb1ved2rUF+NbW+2f8Nq4xidHpp +NKBTXN8ASjBchCl414x99gAISGePaLhBcx+GMHRgDHF6A+RpM8UPAPbIYIAQ4KfMKt4 NJk2UoPwTCnQWg1HgopWoPMwzRRThJCgbT0LV/bY5lLHdH+K4hwIkClzKK7Ik2MiOlmo 57fg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=TZ1ILf36vluQRmD7+XUbNoBKgZDQAlA/hXOW/yYPvow=; b=bzO2kFNVCayJHJCMigVIvJ0kWNr28mRJqEwcBmjluc9PPMsKplg0s9kmh6RVNEkIn5 4gKq2xrxRYPVHj4/fyyrzY1EOUsTWbl6Rla98D//FRv4B2RwzlMYJTBZaS+lAxnB6oty StQefNkIaiHUTbJFhvmf7ZbHpKkjeeltmZTHPJWe/zfpNIXMEaR9hhfEmbPS5c2I+wKV kpjZGyEFB+VD6liWdUTl/9gsFoAf56cqEYQN5I/Qohx9D9zf503pk5qr2m1G2t1c2BAv DYocYk5AAP4nvJ1R2lm2f54RmcjNe61N1+vgBulKP4PP53eyGSWN76TNi3HgOGHIqSmq ju/A== X-Gm-Message-State: AGRZ1gJm6sAoku30A5DAgl4l1fS1aeNGVXwg5je0caNNSPAnFcZk6e10 +2hCpDc0ff/dJYAGxABaUMBcww== X-Received: by 2002:a62:3a04:: with SMTP id h4mr4950852pfa.119.1542770448949; Tue, 20 Nov 2018 19:20:48 -0800 (PST) Received: from [100.112.89.103] ([104.133.8.103]) by smtp.gmail.com with ESMTPSA id 18sm43687573pgl.50.2018.11.20.19.20.47 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 20 Nov 2018 19:20:48 -0800 (PST) Date: Tue, 20 Nov 2018 19:20:40 -0800 (PST) From: Hugh Dickins X-X-Sender: hugh@eggly.anvils To: Vlastimil Babka cc: Hugh Dickins , Baoquan He , Michal Hocko , David Hildenbrand , linux-mm@kvack.org, pifang@redhat.com, linux-kernel@vger.kernel.org, akpm@linux-foundation.org, aarcange@redhat.com, Mel Gorman Subject: Re: Memory hotplug softlock issue In-Reply-To: Message-ID: References: <20181115143204.GV23831@dhcp22.suse.cz> <20181116012433.GU2653@MiWiFi-R3L-srv> <20181116091409.GD14706@dhcp22.suse.cz> <20181119105202.GE18471@MiWiFi-R3L-srv> <20181119124033.GJ22247@dhcp22.suse.cz> <20181119125121.GK22247@dhcp22.suse.cz> <20181119141016.GO22247@dhcp22.suse.cz> <20181119173312.GV22247@dhcp22.suse.cz> <20181119205907.GW22247@dhcp22.suse.cz> <20181120015644.GA5727@MiWiFi-R3L-srv> <3f1a82a8-f2aa-ac5e-e6a8-057256162321@suse.cz> User-Agent: Alpine 2.11 (LSU 23 2013-08-11) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 20 Nov 2018, Hugh Dickins wrote: > On Tue, 20 Nov 2018, Vlastimil Babka wrote: > > > > > > finish_wait(q, wait); > > > > ... the code continues by: > > > > if (thrashing) { > > if (!PageSwapBacked(page)) > > > > So maybe we should not set 'thrashing' true when lock < 0? > > Very good catch, thank you Vlastimil: as you might have guessed, the > patch from a pre-PSI kernel applied cleanly, and I just hadn't reviewed > the surrounding context properly before sending out. > > I cannot say immediately what the right answer is, I'll have to do some > research first: maybe not enter the block that sets thrashing true when > lock < 0, as you suggest, or maybe force lock < 0 to 0 and put_page() > afterwards, or... ... I still won't adjust the patch tonight, but the answer is obvious now I look closer: as you show in your extract above, the only thing it does with "page" at the end is to ask if it was SwapBacked, so we just need to set one more bool at the beginning to check at the end (or I could make "thrashing" a -1, 0, 1 int like "lock": but my guess is that that would not be to other people's taste: acceptable for the arg, but stretching your patience for the local variable). By the way, I do have a further patch to wait_on_page_bit_common(), which I could send at the same time, if it sounds right to you (but it's a no-op in the put_and_wait page migration case). That __add_wait_queue_entry_tail() is right for the first time into the loop, but I maintain that it should use __add_wait_queue() for fairness thereafter, to avoid repeatedly sending older waiters back to the back of the queue. I don't have hard numbers for it, but it's one of several patches, each of which helped to reduce our wait_on_page_bit lockups in some (perhaps unrealistic) stress tests. Hugh