Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp1117693imm; Wed, 13 Jun 2018 13:42:23 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJD4/w5HY/3Qc9HsEvgy9Wiwg9TeV7vmIlkcUH7lBfiaQJ5GZWkZHGXMGn5xlMm9bn5QANU X-Received: by 2002:a62:3c96:: with SMTP id b22-v6mr6226956pfk.235.1528922543301; Wed, 13 Jun 2018 13:42:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528922543; cv=none; d=google.com; s=arc-20160816; b=gj0gRd41/GK1gk02NyYHx9fvEoq5NwE3HzfJofw6ce02+yW4Kmj614eD3oRAnc2oeN s9PA2EftbkKGwTm/dUaJQ4eT+PK7opUMpmBO368EaLx5KFu1hpRBXLRG6oriddhPKl3Z zNwXdpbDgVOFSqFxuWZ4lIbHMl4QppaKbDxjqyymT6hxxEWl7vMzVocPyNOQD6L3Ifw8 dUgUfZfzF2frMIF7YXAjagjiHUna7Dn6z9ATR2IAS4b5xBIaOF1pjqaSRsh30EAoiPcL GyHZ52YZqrjp9sMAjbesmIeBertUpvIYJ65I8LdvnJSXf9U/ORK5HMlj5/fTPjC7uFl+ Aa8w== 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:arc-authentication-results; bh=yUmwqbeZSrN4HEcjAzGY80yFHDXui4OpDyBKoZvn6Yo=; b=mujT5gx9vji6DBaPw1zZH60/5oMvMerN6BIYtXLQcXjOSRRHM7JS9MqPa/VMtpb8eX /gomb1R4oTPEwjwem2V81zbenkXKudvSxc39HVIvbJsM1z3pyMFoTIte5qnOJIcVn9zM Lk6ZS5JQ3tK5deTT/DPDcgL0+9qJHroCz/me2wdWvyFvlmjDMx/lCFOevKN0U9pEpplc 1H0mgzGp1Gb6Ciid7+1NGrcAdzdDM6pHUPCpqAMUXnIt+wV7GFKAhd1dTa/5qaphZykE jButtOJ7xbpDZxrBlbs6+jeNDFLU0M31hV36FTl8ajjh+Y5llM9Q+iimiecrQer7oWcP bKpA== 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=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s17-v6si2958287pgv.639.2018.06.13.13.42.09; Wed, 13 Jun 2018 13:42:23 -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; 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935782AbeFMUli (ORCPT + 99 others); Wed, 13 Jun 2018 16:41:38 -0400 Received: from mga17.intel.com ([192.55.52.151]:32801 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935461AbeFMUlh (ORCPT ); Wed, 13 Jun 2018 16:41:37 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Jun 2018 13:41:36 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,220,1526367600"; d="scan'208";a="57099228" Received: from black.fi.intel.com ([10.237.72.28]) by FMSMGA003.fm.intel.com with ESMTP; 13 Jun 2018 13:41:34 -0700 Received: by black.fi.intel.com (Postfix, from userid 1000) id 763BD166; Wed, 13 Jun 2018 23:41:34 +0300 (EEST) Date: Wed, 13 Jun 2018 23:41:34 +0300 From: "Kirill A. Shutemov" To: Dave Hansen Cc: Ingo Molnar , x86@kernel.org, Thomas Gleixner , "H. Peter Anvin" , Tom Lendacky , Kai Huang , Jacob Pan , linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCHv3 03/17] mm/ksm: Do not merge pages with different KeyIDs Message-ID: <20180613204134.voy7iimrlcywblnx@black.fi.intel.com> References: <20180612143915.68065-1-kirill.shutemov@linux.intel.com> <20180612143915.68065-4-kirill.shutemov@linux.intel.com> <63b7e88f-33d6-c5c1-f6cb-1bbb780e2cc4@intel.com> <20180613203108.k63fda4hvsqyczw7@black.fi.intel.com> <355d6b1f-9188-e93b-9cf1-01ece1879cad@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <355d6b1f-9188-e93b-9cf1-01ece1879cad@intel.com> User-Agent: NeoMutt/20170714-126-deb55f (1.8.3) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 13, 2018 at 08:35:46PM +0000, Dave Hansen wrote: > On 06/13/2018 01:31 PM, Kirill A. Shutemov wrote: > >> What actually happens without this patch in place? > > > > One of processes would get the page mapped with wrong KeyID and see > > garbage. > > OK, but what about two pages with the same KeyID? It's actually totally > possible for KSM to determine that two pages have the same plaintext and > merge them. Why don't we do that? That's exactly what we do :) > > We setup mapping according to KeyID in vma->vm_page_prot. > > Then why do we bother with page_keyid() and the page_ext stuff? VMA is not always around. Using KeyID in vma->vm_page_prot we don't need to change anything in PTE setup functions. It just works. -- Kirill A. Shutemov