Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3250368imu; Mon, 19 Nov 2018 13:00:01 -0800 (PST) X-Google-Smtp-Source: AJdET5cA37qYw/X2Mfq+v553PKZKbTKMwjlX14o9eTII0SjvmeN8nQ8wY2IOXfWj7HHK6YvNXwz3 X-Received: by 2002:a63:e055:: with SMTP id n21mr21780930pgj.397.1542661201565; Mon, 19 Nov 2018 13:00:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542661201; cv=none; d=google.com; s=arc-20160816; b=KsaM4HJzlSiV5f3Gt/wQLPJT4VT9EHw+gBifVzxbdPL58Cp59O74U17mrPVZSHIqT3 IYqhP/11MKXxogMBvTmdepEhAG+boYpUksHV9UhZtckn55hm+0YGyVxlMI6IqpTNcboA VbBOuXSrFg1yUyJJogYEWG7ovPJsV71Qj5MeYRbnz6I15i1MLlCZ+iMtZbKtT4SCwyoJ Wuon7EYdIGtWfyXJvVaHvWZepiDdzXIn0rZM/xyBvzP1i8Z9lWlz42xEHl2HxLj9wz4V rBlXF7S1YqLsyZShndmeIWnFcCY0CONjEHCAoTmddg74DRlJu4muAhnCjtWvcpBFII/Z PmbQ== 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; bh=a/kvfIdUChTMBN9zUyzGAV3HRdyxqTsVfeEm/176smk=; b=ttbSIPjwCryoTleSNHnOpuq5rOK7FQ2j7hxW7SZQD29+C6rlli2/2iSyeKPIS91xFc xu0EADMOjQTwEy0gegoMIajmz2/nIV8wha8OFOy6qOABchoIzeURLdD8DPYnkyY16qZ2 IFIkbZaDcHSWdff/jVTxRNFXs4wFFpuZkAFG0iaemJHUMWO6O8vAsi+khczYEUno7zGV arK0hEkHzwQhqSs5fAesbs3rWMrKhn+2mtxUaQ66XEbmamWpczwD8D9YoSe8ZOGe///o iUvabcyYoVE8gWt126VBo3mNNPS16i5qFHEyv125Sj+IcaDDJYJ7uI00Ryosv5gJGRHx vZAw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e69si26722362pfg.137.2018.11.19.12.59.46; Mon, 19 Nov 2018 13:00:01 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730862AbeKTHYf (ORCPT + 99 others); Tue, 20 Nov 2018 02:24:35 -0500 Received: from mx2.suse.de ([195.135.220.15]:52310 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730755AbeKTHYf (ORCPT ); Tue, 20 Nov 2018 02:24:35 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 43680B03B; Mon, 19 Nov 2018 20:59:08 +0000 (UTC) Date: Mon, 19 Nov 2018 21:59:07 +0100 From: Michal Hocko To: Hugh Dickins Cc: Baoquan He , David Hildenbrand , linux-mm@kvack.org, pifang@redhat.com, linux-kernel@vger.kernel.org, akpm@linux-foundation.org, aarcange@redhat.com, Mel Gorman , Vlastimil Babka Subject: Re: Memory hotplug softlock issue Message-ID: <20181119205907.GW22247@dhcp22.suse.cz> References: <20181115133840.GR2653@MiWiFi-R3L-srv> <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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon 19-11-18 12:34:09, Hugh Dickins wrote: > On Mon, 19 Nov 2018, Michal Hocko wrote: > > On Mon 19-11-18 15:10:16, Michal Hocko wrote: > > [...] > > > In other words. Why cannot we do the following? > > > > Baoquan, this is certainly not the right fix but I would be really > > curious whether it makes the problem go away. > > > > > diff --git a/mm/migrate.c b/mm/migrate.c > > > index f7e4bfdc13b7..7ccab29bcf9a 100644 > > > --- a/mm/migrate.c > > > +++ b/mm/migrate.c > > > @@ -324,19 +324,9 @@ void __migration_entry_wait(struct mm_struct *mm, pte_t *ptep, > > > goto out; > > > > > > page = migration_entry_to_page(entry); > > > - > > > - /* > > > - * Once page cache replacement of page migration started, page_count > > > - * *must* be zero. And, we don't want to call wait_on_page_locked() > > > - * against a page without get_page(). > > > - * So, we use get_page_unless_zero(), here. Even failed, page fault > > > - * will occur again. > > > - */ > > > - if (!get_page_unless_zero(page)) > > > - goto out; > > > pte_unmap_unlock(ptep, ptl); > > > - wait_on_page_locked(page); > > > - put_page(page); > > > + page_lock(page); > > > + page_unlock(page); > > > return; > > > out: > > > pte_unmap_unlock(ptep, ptl); > > Thanks for Cc'ing me. I did mention precisely this issue two or three > times at LSF/MM this year, and claimed then that I would post the fix. I've had a recollection about some issue I just couldn't remember what was it exactly. Tried to make Vlastimil to remember but failed there as well ;) > I'm glad that I delayed, what I had then (migration_waitqueue instead > of using page_waitqueue) was not wrong, but what I've been using the > last couple of months is rather better (and can be put to use to solve > similar problems in collapsing pages on huge tmpfs. but we don't need > to get into that at this time): put_and_wait_on_page_locked(). > > What I have not yet done is verify it on latest kernel, and research > the interested Cc list (Linus and Tim Chen come immediately to mind), > and write the commit comment. I have some testing to do on the latest > kernel today, so I'll throw put_and_wait_on_page_locked() in too, > and post tomorrow I hope. Cool, it seems that Baoquan has a reliable test case to trigger the pathological case. -- Michal Hocko SUSE Labs