Path: csiph.com!news.mixmin.net!aioe.org!bofh.it!news.nic.it!robomod From: "Kirill A. Shutemov" Newsgroups: linux.kernel Subject: Re: [PATCH 1/2] mm: fix bogus VM_BUG_ON_PAGE() in isolate_lru_page() Date: Mon, 01 Feb 2016 15:40:02 +0100 Message-ID: References: Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shutemov-name.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=b2Ovmg7D21jM/01RsJTfCAXTEwXdkBB7tqOId52IDU0=; b=eCf9vWQC+xjHuIp/XRCTZTFKpYlV5B3OmIkJ0dX8VFEtZtOFCXHc5mjYaZi2WtlvrT +GaMIFYGUkcCZuDQ0fIc37GE2YF39FsZlvLMseGXR/bmPbOf4Vx4yUmyIeMkeErTurlC HIQ26L6BG0x8Oaim4+HorAEHPtRIdwGBEthQV44ibswjeQEbkDQBCnB7tNYFCjzan/6U SssCBgOxKdzKPp6NiMy9jFl5tVdb3LGEbfrlt4whDlS2IoxszIE9dfzqFOwTtry9c3Ub v28AOJUgzYVlckpFmml+vMdA5He6m5yWWWGtmLBWp3FQJ84wGK1yk9gCq1aWm4W75Qzv B6Cg== X-Google-Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-type:content-disposition:in-reply-to :user-agent; bh=b2Ovmg7D21jM/01RsJTfCAXTEwXdkBB7tqOId52IDU0=; b=fgUVHCUFozpKtWRh0luI/KkAfGj0WmQzNOMUqaYwJcBywXlzs7RFdKh/D0oG2mlUC0 yB7hD7I9Ln5tkwsrZR/ylzjDueZuT/JE01DzUVXtY8woAcQIexR0x0dnv6SbTJpQvNJC aNkN7Ata1Sb0M61hJJZvZMXqFd20wUq8hE9iFC78zg09UWJ1fh2k8bvl0i09TOWDqAa5 Z11KOu2E4nNBea+yItBmFNdHWtP6KGbuopNpUknv60HjNS1Sg9+oTSGG02JBGfxSSH+j kwCNb640RF2GhYPrLGcmf8b4eEXL9ZJXa5kmEojm/VLIOU46YbaOIgVDmBfc5kQXEIFH 0m0A== X-Gm-Message-State: AG10YORi0Z7lLOmXX9WwcZpiB2gpE2h53wNsaB6oEHNKQQxYAloj7VCeRCTieAg7sNtTrQ== X-Received: by 10.194.133.233 with SMTP id pf9mr23128923wjb.75.1454337535343; Mon, 01 Feb 2016 06:38:55 -0800 (PST) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.23.1 (2014-03-12) Sender: robomod@news.nic.it List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Approved: robomod@news.nic.it Lines: 23 Organization: linux.* mail to news gateway X-Original-Cc: "Kirill A. Shutemov" , Andrew Morton , Dmitry Vyukov , Vlastimil Babka , David Rientjes , Naoya Horiguchi , linux-mm@kvack.org, linux-kernel@vger.kernel.org X-Original-Date: Mon, 1 Feb 2016 16:38:53 +0200 X-Original-Message-ID: <20160201143853.GA30090@node.shutemov.name> X-Original-References: <1454333169-121369-1-git-send-email-kirill.shutemov@linux.intel.com> <1454333169-121369-2-git-send-email-kirill.shutemov@linux.intel.com> <20160201142446.GB24008@dhcp22.suse.cz> X-Original-Sender: linux-kernel-owner@vger.kernel.org Xref: csiph.com linux.kernel:1323175 On Mon, Feb 01, 2016 at 03:24:46PM +0100, Michal Hocko wrote: > On Mon 01-02-16 16:26:08, Kirill A. Shutemov wrote: > > We don't care if there's a tail pages which is not on LRU. We are not > > going to isolate them anyway. > > yes we are not going to isolate them but calling this function on a > tail page is wrong in principle, no? PageLRU check is racy outside of > lru_lock so what if we are racing here. I know, highly unlikely but not > impossible. So I am not really sure this is an improvement. When would > we hit this VM_BUG_ON and it wouldn't be a bug or at least suspicious > usage? Yes, there is no point in calling isolate_lru_page() for tail pages, but we do this anyway -- see the second patch. And we need to validate all drivers, that they don't forget to set VM_IO or make vma_migratable() return false in other way. Alternative approach would be to downgrate the VM_BUG_ON_PAGE() to WARN_ONCE_ON(). This way we would have chance to catch bad callers. -- Kirill A. Shutemov