Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp652621imu; Thu, 13 Dec 2018 02:02:18 -0800 (PST) X-Google-Smtp-Source: AFSGD/VN46nU/m1orI5Dy0IefNQBNTXcdF4vq+feIlEzZf1no2AwniRJOmamkKT1unnKBrIOa0Qj X-Received: by 2002:a65:58ca:: with SMTP id e10mr19413678pgu.99.1544695338294; Thu, 13 Dec 2018 02:02:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544695338; cv=none; d=google.com; s=arc-20160816; b=rCfNIJnfSeSmcRdtvhHBAxL1XAFR5uJhDSp4LhCMV79dNbSLZVcM+b//snz0sb+/RP 1lhy/dwTUDeqPwiXGVE83M8EF+Z6MVwlcD9Eb7czlDU4vgihoagOdjKydasdD8lrYDvl ppStTYs+wkk0aNm+AS0iot7ySDF75Jte/STnkdKamqRjnXe1ZcxhzTMyGTUnt2WC2Se5 /58CQJjssFXLchsiY7xigzTgoJmSKzLlRzTXKxzRXfSXM1PREz6jgkwRKT7TUQn9qk/E p4RXc7kt6qZBJona6gXFy9nBRToASUl1FGxXF44bIQ5sEoc1i/+HCf7emBeRYzUdmNCS LcXg== 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=StY9UoDCFG8zhjwZLxYYNU8yZ08AN+ukRIO/5DBAz74=; b=gM1W6Fau0sOHDBk/F+krXOXhXxfq4ORf2iu5H4ZRAYvU4HshUoWyqP7j0lNp7zfLJP IJaAggXNa+RB4R12LIwRn87j9DCW4MsXqk1lT2WuDLi1VZK5WS3gmt7JixC7hIf3eNoe 7QLKPtVlQGeVK4BhEUp0WzxKoV9DGNAh/GIoQhAHOn4J3cj1XM1bvyh/3ihnUF/ZkqN5 g2jj4c94qzeF/+crSw0ritTcnljCMQOlz2UsuJQndP0ddctwdP+3V6MZN9w7AnhmXvrF RliI55N4YKt67gjRezTEkkQhZ8As2sbap11aISUdNUr6em7CfgfZCULa0N+xF002J2KV GRew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@shutemov-name.20150623.gappssmtp.com header.s=20150623 header.b=edA1ac7J; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d23si1256780pgm.559.2018.12.13.02.02.03; Thu, 13 Dec 2018 02:02:18 -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=@shutemov-name.20150623.gappssmtp.com header.s=20150623 header.b=edA1ac7J; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728067AbeLMJ7t (ORCPT + 99 others); Thu, 13 Dec 2018 04:59:49 -0500 Received: from mail-pl1-f196.google.com ([209.85.214.196]:37250 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727455AbeLMJ7t (ORCPT ); Thu, 13 Dec 2018 04:59:49 -0500 Received: by mail-pl1-f196.google.com with SMTP id b5so836095plr.4 for ; Thu, 13 Dec 2018 01:59:48 -0800 (PST) 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-disposition:in-reply-to:user-agent; bh=StY9UoDCFG8zhjwZLxYYNU8yZ08AN+ukRIO/5DBAz74=; b=edA1ac7JuDNexgPdC3wZoVcvjzN66CwS+HyQaNEc+gi3CNBv76AuQHu4H5H4nTp1Ml hb6sUx9fo5i7Jxk91nrFLcXCa1XxC7idQGINiTYxbmpyyM15msD3dWRn5Hcbf7QRXVjO wxd8EqtPRX7iE0x9paoyNv55rrQzgJttrB9kCe9c6ALc6NF8f6/O4US+iWjgHqT0NzUk l3TEeJ+VcsnEp4KqryfS5TNT6xOubWvnkyEB2J9zwW6qhZvyrYkOtFDAfLl8D9RseVsF RD7w+YNF5yQfg59rEktidBsIcDgRmBkMN+pLoHOjWfW9mRlG75mMBqqxtZrN7JVfbZqa pyNA== 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:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=StY9UoDCFG8zhjwZLxYYNU8yZ08AN+ukRIO/5DBAz74=; b=p1lIH64L+mx0dzQqfh2arjkkm2aH1RUFI1QZQlsCG5DKdW8aa2BIGBcZkxZJlNt9rp 6qG7RylXQLm/32yu8VtuSOm184SctjHZG1+Dj8grgFZeWfNXbx0NspjaUA94oucQGWy6 5gSe1tZyWiPhSBmHldv/NwGA5Zvr8nMjOFmzWaL9RMO4KjXfYt2qErrsY0Ci2/yz18qZ TOa44w0WFY+6ylws5r9vHiiyE48Fqcx83zsEqo9rfK8hBrg/Z+Y662sda0cYJY+YGrrb Yn9Bbr2mfSHtNAzC6kQejiD+0PEQuzdQcm/dyNx4CQq1Qm0C8po0miXuyA4E9E4iSR6e SRNw== X-Gm-Message-State: AA+aEWa7t+jNQwEg1pz0XRzRHwSAXtcBptuhLVEesvS2/mn7X2o68n8I eaAdt8NWz79RkJWmunHOW2d1ug== X-Received: by 2002:a17:902:2006:: with SMTP id n6mr23464371pla.66.1544695188151; Thu, 13 Dec 2018 01:59:48 -0800 (PST) Received: from kshutemo-mobl1.localdomain ([192.55.54.45]) by smtp.gmail.com with ESMTPSA id d21sm2315350pgv.37.2018.12.13.01.59.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Dec 2018 01:59:47 -0800 (PST) Received: by kshutemo-mobl1.localdomain (Postfix, from userid 1000) id CD55A300258; Thu, 13 Dec 2018 12:59:42 +0300 (+03) Date: Thu, 13 Dec 2018 12:59:42 +0300 From: "Kirill A. Shutemov" To: Peter Xu Cc: linux-kernel@vger.kernel.org, Andrea Arcangeli , Andrew Morton , "Kirill A. Shutemov" , Matthew Wilcox , Michal Hocko , Dave Jiang , "Aneesh Kumar K.V" , Souptick Joarder , Konstantin Khlebnikov , Zi Yan , linux-mm@kvack.org Subject: Re: [PATCH v3] mm: thp: fix flags for pmd migration when split Message-ID: <20181213095942.3y7lfdwndek6sja4@kshutemo-mobl1> References: <20181213051510.20306-1-peterx@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181213051510.20306-1-peterx@redhat.com> User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Dec 13, 2018 at 01:15:10PM +0800, Peter Xu wrote: > When splitting a huge migrating PMD, we'll transfer all the existing > PMD bits and apply them again onto the small PTEs. However we are > fetching the bits unconditionally via pmd_soft_dirty(), pmd_write() > or pmd_yound() while actually they don't make sense at all when it's > a migration entry. Fix them up. Since at it, drop the ifdef together > as not needed. > > Note that if my understanding is correct about the problem then if > without the patch there is chance to lose some of the dirty bits in > the migrating pmd pages (on x86_64 we're fetching bit 11 which is part > of swap offset instead of bit 2) and it could potentially corrupt the > memory of an userspace program which depends on the dirty bit. > > CC: Andrea Arcangeli > CC: Andrew Morton > CC: "Kirill A. Shutemov" > CC: Matthew Wilcox > CC: Michal Hocko > CC: Dave Jiang > CC: "Aneesh Kumar K.V" > CC: Souptick Joarder > CC: Konstantin Khlebnikov > CC: Zi Yan > CC: linux-mm@kvack.org > CC: linux-kernel@vger.kernel.org > Signed-off-by: Peter Xu Acked-by: Kirill A. Shutemov Stable? -- Kirill A. Shutemov