Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp1115291imm; Thu, 31 May 2018 15:51:25 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJ+Y6+YvT5sXjyFXAaoGRNV+9JV5io87I1yXz1Fgr2vGzQJEEuw53TGpnhcVmOQqxxxc/3d X-Received: by 2002:a17:902:d716:: with SMTP id w22-v6mr8484829ply.98.1527807085330; Thu, 31 May 2018 15:51:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527807085; cv=none; d=google.com; s=arc-20160816; b=07tHXyimJ3VpJnntZ6O+eZKUPWaLQSLiA6BmFgJyLAEKh4X6jsql3fY5GXfX2Fe1HD XjD0jPaEpw/7a9vBD0TXZiOHi+MgmTLP5Zp/2TVHcasaZat++Tc1bBWuVocvLuSEWZTQ lfCdFuChsyhPvC9hQwBOiosD05BaCLFzIlHwl6t1Kj40DS1klsKnb48g/mCajIbY1cjX o7rIbTMozhb5aGYZ9ZWlspL82jqK0XlSTTqBirjLCJf8x5daRj7iokAb+nDhGAE8sWt4 CvT1dOG75MmtsrBDWAORtRZ++EpZAjf1EUnOcYn5Swaxi4KqWObjObYslFTJopNkfCWR ur4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date:dkim-signature :arc-authentication-results; bh=bdu3t38xs2GORnanrRZ1ulCIVIrMbwHGPUf6wStvHFY=; b=nWHHnXN+FL30TH7x0Lj6imhNsJCfQ5y4E4f8xixrUQ2rO/vQB54Fu0qCsDQpYRETqY 8ScPqoe57ufX2FCz1M6cREPKQTWzMbwxGUhX3GhygAjswnCvjhgXQbBkaBJ6RiG9Dv7m q5a6OPTjVPvgTL+/2adw1B96NLE7GbXOCk0cB9RPUchc8FEFzCASELRnnCPSroAY98qq VxFM8vLMB8JdXVcqUmNNMR8A/AU4L3YyWaqwrkfWuBDqdphAs5+PcBvRxC2Ogjg5Bdru j8Zz6BBJRrglSdFGeppxPm3ZsT0XyDaWtC1yPQhdfivensfv4iDPeVFKu3n/sXB/mV86 PAOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=DO2fribL; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bj6-v6si37803746plb.405.2018.05.31.15.51.10; Thu, 31 May 2018 15:51:25 -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=@google.com header.s=20161025 header.b=DO2fribL; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750931AbeEaWur (ORCPT + 99 others); Thu, 31 May 2018 18:50:47 -0400 Received: from mail-pf0-f193.google.com ([209.85.192.193]:37950 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750766AbeEaWup (ORCPT ); Thu, 31 May 2018 18:50:45 -0400 Received: by mail-pf0-f193.google.com with SMTP id b74-v6so8041851pfl.5 for ; Thu, 31 May 2018 15:50:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=bdu3t38xs2GORnanrRZ1ulCIVIrMbwHGPUf6wStvHFY=; b=DO2fribLBdtjJWQ2jxjG7YuHUPSWkeeL04R/AHlct+Fl0EsQb76kCn1aJX7IJuIiyt Q9eBEnwhTbL5o9Uc7N9514bZTKZOQkZblJNkKIfml0BYf+uybDRHahwDD5VEKTZX8H0h Z5TjlWS0T4Dy/AZ9njEvdEGZjX45hjt16y+4gPTQmeFrZfBNTfO1tjx+wwPHrxtb5VRr /7Aa02Ys67HYI5Ce8pt2UDo4lt4MdC6PFi+GauBHNz+yVx7pMJHrXvR2zYeyQuR6hYIs c6wMqVAd+xm4oZx0ieO1+RXJ3ReOEIfiwylTd8Ju6tcZDMXW4FvrwGAb0MYW9f94+EAw pJow== 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:in-reply-to:message-id :references:user-agent:mime-version; bh=bdu3t38xs2GORnanrRZ1ulCIVIrMbwHGPUf6wStvHFY=; b=Q8H0J4Dlkg8U3cvLggWPrWz4SuhClPuLADXm0AVoqsKjxB4XizARFZchDcLkCjFyr3 QBvFUOTLnLQp22qFrceeBWQgPyknonjYDnlwLQk+lcJSSRxMoGo1s761AMl5c0pdALUt Vf2dBomANLUaSV1mI9GX/VJe6Cg7MJSnIIwEiK3Sup2gKs+pgrnu765Sxg4nWrl0XBQw vDbE5qyDRIiyQV/UqGnKleZ45YZfVBBXvaqac5DjIv3wpqclbA2E7XgVsZ3ZVbuC9Bz5 0Ef/eXp74DUzQ6S+INW1AR4UFINjNVmpH3u81D/HM5Ve/oEX2gb5PxIEHBk6u2HdDGNR D/PQ== X-Gm-Message-State: ALKqPwdVDjUulFQm1627PzvVTN6QKIPcnsNBy3Cbl6e6qDcjuXgdasMz 0oOyfEVOCiyf81PYG+56gFj2Fg== X-Received: by 2002:a62:968f:: with SMTP id s15-v6mr478425pfk.191.1527807045184; Thu, 31 May 2018 15:50:45 -0700 (PDT) Received: from [100.112.72.59] ([104.133.9.107]) by smtp.gmail.com with ESMTPSA id x24-v6sm7504212pfj.104.2018.05.31.15.50.43 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 31 May 2018 15:50:44 -0700 (PDT) Date: Thu, 31 May 2018 15:50:36 -0700 (PDT) From: Hugh Dickins X-X-Sender: hugh@eggly.anvils To: "Kirill A. Shutemov" cc: Andrew Morton , Hugh Dickins , Josef Bacik , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm/shmem: Zero out unused vma fields in shmem_pseudo_vma_init() In-Reply-To: <20180531135602.20321-1-kirill.shutemov@linux.intel.com> Message-ID: References: <20180531135602.20321-1-kirill.shutemov@linux.intel.com> User-Agent: Alpine 2.11 (LSU 23 2013-08-11) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 31 May 2018, Kirill A. Shutemov wrote: > shmem/tmpfs uses pseudo vma to allocate page with correct NUMA policy. > > The pseudo vma doesn't have vm_page_prot set. We are going to encode > encryption KeyID in vm_page_prot. Having garbage there causes problems. > > Zero out all unused fields in the pseudo vma. > > Signed-off-by: Kirill A. Shutemov I won't go so far as to say NAK, but personally I much prefer that we document what fields actually get used, by initializing only those, rather than having such a blanket memset. And you say "We are going to ...": so this should really be part of some future patchset, shouldn't it? My opinion might be in the minority: you remind me of a similar request from Josef some while ago, Cc'ing him. (I'm very ashamed, by the way, of shmem's pseudo-vma, I think it's horrid, and just reflects that shmem was an afterthought when NUMA mempolicies were designed. Internally, we replaced alloc_pages_vma() throughout by alloc_pages_mpol(), which has no need for pseudo-vmas, and the advantage of dropping mmap_sem across the bulk of NUMA page migration. I shall be updating that work in coming months, and hope to upstream, but no promise from me on the timing - your need for vm_page_prot likely much sooner.) Hugh > --- > mm/shmem.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/mm/shmem.c b/mm/shmem.c > index 9d6c7e595415..693fb82b4b42 100644 > --- a/mm/shmem.c > +++ b/mm/shmem.c > @@ -1404,10 +1404,9 @@ static void shmem_pseudo_vma_init(struct vm_area_struct *vma, > struct shmem_inode_info *info, pgoff_t index) > { > /* Create a pseudo vma that just contains the policy */ > - vma->vm_start = 0; > + memset(vma, 0, sizeof(*vma)); > /* Bias interleave by inode number to distribute better across nodes */ > vma->vm_pgoff = index + info->vfs_inode.i_ino; > - vma->vm_ops = NULL; > vma->vm_policy = mpol_shared_policy_lookup(&info->policy, index); > } > > -- > 2.17.0