Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp4835182imm; Tue, 9 Oct 2018 06:05:06 -0700 (PDT) X-Google-Smtp-Source: ACcGV61UwgJRevR9y4WsoV7lo/LKYw/v+FdtLbnpv2YWH6FjK2cZeC5rO4/340jj03ToBJuD8m+R X-Received: by 2002:a62:1c06:: with SMTP id c6-v6mr30389616pfc.41.1539090306768; Tue, 09 Oct 2018 06:05:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539090306; cv=none; d=google.com; s=arc-20160816; b=QrjI3F9ZVlinkGK3HH61pQXbnevDDfbHjdqk3j3B6Y0Wlsu6vEFeJE4NaLRUuSOYpW MtICLtZ4vDj0qXZS6SUsLZPEkTwEBksGmBmOhbpS+7F2KZOk96zPKgQP7o8wIobS+FkD NuZVTdNZ7sN4kmbcvV8IC2IDm8Q2KLWx8Ww0rIf/vBni6jHYYtNHNAjYpuO5Hs9Df2QR CRtvELtYmPBonqAVMcksykrKNwfzMhR8ajEQlV+IJAzmhzymTrhYEm7MjaznVfb9a3t7 10OyHZ+H8mpBt2o6SnwR5DDUGx1wbGEyff/XW+mJIIAGU2eFSq2alBbRFCOBJuaQJQIU tDnQ== 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=bqbn54rjw//b2QRHCIjUQx2Ghefp44UA3koJ2X+R9VY=; b=m9CL+4UYiwihCrBY+fLjPbc/7AH2b+oRwSdkd7RJfVjhFGhJG93zedM0TcDGRTU4fQ 5+J+UTOQ4+dENM0aeS8PT6hIB5UjDeI7KFLP1eStCG5wYuYFY1z0jtrgq9FUwR0C0oXv QohuEbwM9OWfveyI7dl6y8+SVUACsyMwRywSVxhJaTX09bKPjRCuvSgWMkU6BttKo1Ke JdE/KNM1+YlhIiuazFA3Y51XtbD01doHc3IS6agh+SfSN2dHlZfk5P1QQvniApmYuUWQ ErAiY4Lb8OBdrSIE+AglEATDZ8ymZZ027LpOeGtgVIylZU+8TGwDsJy8UUUzRBFEzpiv UiVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@shutemov-name.20150623.gappssmtp.com header.s=20150623 header.b=T4axNBYx; 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 t20-v6si22255201plj.261.2018.10.09.06.04.50; Tue, 09 Oct 2018 06:05:06 -0700 (PDT) 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=T4axNBYx; 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 S1726569AbeJIUVT (ORCPT + 99 others); Tue, 9 Oct 2018 16:21:19 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:34402 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726415AbeJIUVS (ORCPT ); Tue, 9 Oct 2018 16:21:18 -0400 Received: by mail-pf1-f193.google.com with SMTP id k19-v6so828048pfi.1 for ; Tue, 09 Oct 2018 06:04:27 -0700 (PDT) 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=bqbn54rjw//b2QRHCIjUQx2Ghefp44UA3koJ2X+R9VY=; b=T4axNBYxVG+lL/3jodkn0emz/GyacesB+nF7GLj3VBqC3ueKWVbDq73mOiYrqI4tDl prQoscbt/8nwUivrdcSRbndANwNgT8dXau6ry3JrzzFRyMTd3pcY9mpd7OaC0NCmyWWH UolNxTKbmqiw+YNM0SaQ2IRYFRqOJRpcprWmQYMSMlVpLZiJivpPoqS6Wm5+MLGfOuYG pn9NVcZWLngi0NUfa2agZuKLyI4PjLR192vW2tBp+UeFyP73RqsfZz6d6ra7XWeZKm7S YEqwtEr5JHmcUmVihvNAEJ5WcYaJYXFdlRlp5ObnHBRiqbW/rwXluB9dF+T3P18GOQt+ An8A== 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=bqbn54rjw//b2QRHCIjUQx2Ghefp44UA3koJ2X+R9VY=; b=e9+Um4GPk1f5QwXwWY1ay0PuZc5nZ6CKy9nNo9QAJnDMIFPgvIb01zH35ELvf027xa Hr5+T3JTcZjxNa+o1YpOyZ8cvE1KCmm8TLBRne4ZkiHUecjMiJbeWH/xs1XR0+L0XUY7 +zk5j3S1caoP2qkhZUn+T3QDbX5Ys39ttOHKmW9odSzsBK0Xj0dFXHMQzVPts7+aSJAS 86S7CzfZiVf1E0OOQOs1le+EXz5lKXLarAPaV8LAUR1/ajeoe8NqZgTwvc2WP1f6zt8H LKySNoVXQQZdiBqt1UsCBnpfdCkiNSKVTRKpfUjT+3BtIoZ3lbMkEattLPZb/fZsNoC0 u4vQ== X-Gm-Message-State: ABuFfoj7sNO0O+pdsjQS7QZnzBk45ak53yF+0gwt2ugFZ++V8bCq4mY6 2lGQHJVg+UmDN/yGZ3FVqJd0UA== X-Received: by 2002:a62:475c:: with SMTP id u89-v6mr3099557pfa.212.1539090266943; Tue, 09 Oct 2018 06:04:26 -0700 (PDT) Received: from kshutemo-mobl1.localdomain ([192.55.54.45]) by smtp.gmail.com with ESMTPSA id h14-v6sm23125920pfn.80.2018.10.09.06.04.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Oct 2018 06:04:25 -0700 (PDT) Received: by kshutemo-mobl1.localdomain (Postfix, from userid 1000) id 2531530002C; Tue, 9 Oct 2018 16:04:21 +0300 (+03) Date: Tue, 9 Oct 2018 16:04:21 +0300 From: "Kirill A. Shutemov" To: Anshuman Khandual Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, kirill.shutemov@linux.intel.com, akpm@linux-foundation.org, mhocko@suse.com, zi.yan@cs.rutgers.edu, will.deacon@arm.com Subject: Re: [PATCH] mm/thp: Correctly differentiate between mapped THP and PMD migration entry Message-ID: <20181009130421.bmus632ocurn275u@kshutemo-mobl1> References: <1539057538-27446-1-git-send-email-anshuman.khandual@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1539057538-27446-1-git-send-email-anshuman.khandual@arm.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 Tue, Oct 09, 2018 at 09:28:58AM +0530, Anshuman Khandual wrote: > A normal mapped THP page at PMD level should be correctly differentiated > from a PMD migration entry while walking the page table. A mapped THP would > additionally check positive for pmd_present() along with pmd_trans_huge() > as compared to a PMD migration entry. This just adds a new conditional test > differentiating the two while walking the page table. > > Fixes: 616b8371539a6 ("mm: thp: enable thp migration in generic path") > Signed-off-by: Anshuman Khandual > --- > On X86, pmd_trans_huge() and is_pmd_migration_entry() are always mutually > exclusive which makes the current conditional block work for both mapped > and migration entries. This is not same with arm64 where pmd_trans_huge() > returns positive for both mapped and migration entries. Could some one > please explain why pmd_trans_huge() has to return false for migration > entries which just install swap bits and its still a PMD ? I guess it's just a design choice. Any reason why arm64 cannot do the same? > Nonetheless pmd_present() seems to be a better check to distinguish > between mapped and (non-mapped non-present) migration entries without > any ambiguity. Can we instead reverse order of check: if (pmd_trans_huge(pmde) || is_pmd_migration_entry(pmde)) { pvmw->ptl = pmd_lock(mm, pvmw->pmd); if (!pmd_present(*pvmw->pmd)) { ... } else if (likely(pmd_trans_huge(*pvmw->pmd))) { ... } else { ... } ... This should cover both imeplementations of pmd_trans_huge(). -- Kirill A. Shutemov