Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1318329imm; Wed, 1 Aug 2018 13:53:16 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfGBx5VgbiNVb2eMYUhVYMpRQKcMibz3hfb78BHh3VuSg7n1URcwqrigH5+frUX2/HKFl6y X-Received: by 2002:a17:902:b08d:: with SMTP id p13-v6mr26748998plr.0.1533156796891; Wed, 01 Aug 2018 13:53:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533156796; cv=none; d=google.com; s=arc-20160816; b=n9+mOR21geAGlMuWF/twhE2hcC9xMW3vPZ3zOnPRFGh0hCC9Lo9bzrrdCK+GaNcrpm lqlnSlN04kzUwbEL3XG+MO1OQnYaoSKRWEGkwqd4GoxUvuVscBUkisbqjHWpGPnIgNpZ MeRWxrWWIhu3Ydk4L6LXAD9k0FFaJJ6H9hrKv3E1EbPx+oyLG5bUad6M9Ge2amdwsPAJ lRUgcpCZd+6rZeFgahIMjkFftdUF1Rd2of9OedJIXj0ZsgR6c3BWj6b6T6KSEE12g/8s nrpEhthsEVzpt29nKBL636J3MC/DnB/M2nmMCzfs0ImYbyKAnojP09s5ILhW9v6IiNLE Ztsw== 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:arc-authentication-results; bh=GEkNdPZT8FgrW8d41h3kYQxe3sqtkvO5e53/7nsEODQ=; b=aIo/4V78zuvJyOpEA09Wmx9JlpIRRk7w0a+y0AYrsm/z4oS4KdQs4/u27mcQhlSJwv mF0/obWh1R6tCuYS/gQwXU5UotcSBNvIB7RXR2bG+4Bz+OPr6Ls4l1bUzB+B45N6eai4 YQJKviga5e+i74w9w0pw6FO8LiCVvsh+t44BMGi0Uk/bzF/Ed0J6PdIJ4vhkBZHncj6m I6OMfl7w3Vrd61niNBylBAugp4UZZxJt6NPqml1H5LK0hQASUeaJAAj4JCIA5+Wg2izl U6ZKrgjoYNVDWGZz4rB+/Yceub5jO0nftNTe233hj/PvB33eLzzSzWoMXqnm5BL5G48e oWsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@shutemov-name.20150623.gappssmtp.com header.s=20150623 header.b=MWuvuzs6; 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 b1-v6si16537794pli.54.2018.08.01.13.53.02; Wed, 01 Aug 2018 13:53:16 -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=MWuvuzs6; 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 S1732443AbeHAWjk (ORCPT + 99 others); Wed, 1 Aug 2018 18:39:40 -0400 Received: from mail-pl0-f66.google.com ([209.85.160.66]:36529 "EHLO mail-pl0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732178AbeHAWjk (ORCPT ); Wed, 1 Aug 2018 18:39:40 -0400 Received: by mail-pl0-f66.google.com with SMTP id e11-v6so9335021plb.3 for ; Wed, 01 Aug 2018 13:52:03 -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=GEkNdPZT8FgrW8d41h3kYQxe3sqtkvO5e53/7nsEODQ=; b=MWuvuzs6E5Z4NMRpcRC37oqy+iWsEN454JH+Oq9muZd1dTRQWS//0qhe5ORbh0WFWS cuOC6GMwRfwQVgQsPBEx+HS6gra82Jr20F2W5VQCC2dnxbA0I78SzOzq7hyC+SUV1e7p FdG5xAbZY+sWbhBhqp+0ChPHByosv4qfp7cnYr5SqPgFBIXOHfAV5IZBcQ3oKvCYbFup KhYNakMqg3i1G1QjkUIFGj5+Mj1uA0xcqRb2M+PhMKw+9X9fQNekTzXHoZ+PrhT438LW PVEnaSyZFuQFvXYtcMgEahLGNTWTWP04AUXhyCe/kVBPAt3j65mDUrtxIDbnzfz5LH2l I/tg== 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=GEkNdPZT8FgrW8d41h3kYQxe3sqtkvO5e53/7nsEODQ=; b=rToj4IJrUzhoJc7CoesLPPTwNNlnlFJpwP+tG/YIQXqcHpwTXqgB5y3Zyp49RuKpVj bdcLTvqMnPygS6a1AJ8l8R8oCl4QqXRaJuD+ZP22PY2EIPrtHx2ynN9cZqelWFeaqNwF 6GF8MvpFbeYRA/IN4kCTcp+aIf278/acOCBEIVNaQKI+qeLSthMt8fGC6LVQlZu/E16+ Ls8mtRJfLQm2f0XL/bjmmb7h/lhClmLuN4a3Dfycq1ptWY1YYUr9Aj43sOHg3Qm95zzv /wXOY0b5Qkxaeg5HmXpn7I9lTpkpCrVPxt2Vz6kxu7c41n2AMG304yRDG27YkBLWRO9i VLZg== X-Gm-Message-State: AOUpUlGyOVjXyGlbhLqzF0ymH9d+wuRwKcrMibRrChsFaUFWT9BJGzI5 4OBqnKryL/5y2IxS6AHNX2DGVw== X-Received: by 2002:a17:902:da4:: with SMTP id 33-v6mr25697088plv.193.1533156722890; Wed, 01 Aug 2018 13:52:02 -0700 (PDT) Received: from kshutemo-mobl1.localdomain ([192.55.54.42]) by smtp.gmail.com with ESMTPSA id h190-v6sm24785911pge.85.2018.08.01.13.52.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 01 Aug 2018 13:52:02 -0700 (PDT) Received: by kshutemo-mobl1.localdomain (Postfix, from userid 1000) id 2F28E3002A5; Wed, 1 Aug 2018 23:51:56 +0300 (+03) Date: Wed, 1 Aug 2018 23:51:56 +0300 From: "Kirill A. Shutemov" To: Linus Torvalds Cc: Tony Luck , Amit Pundir , John Stultz , Hugh Dickins , Matthew Wilcox , "Kirill A. Shutemov" , Andrew Morton , Dmitry Vyukov , Oleg Nesterov , Andrea Arcangeli , Greg Kroah-Hartman , linux-mm , Linux Kernel Mailing List , youling 257 , Joel Fernandes , Colin Cross Subject: Re: Linux 4.18-rc7 Message-ID: <20180801205156.zv45fcveexwa2dqs@kshutemo-mobl1> References: <20180731170328.ocb5oikwhwtkyzrj@kshutemo-mobl1> <20180731174349.GA12944@agluck-desk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 01, 2018 at 01:05:48PM -0700, Linus Torvalds wrote: > On Wed, Aug 1, 2018 at 10:15 AM Linus Torvalds > wrote: > > > > I'm still unhappy about the vma_init() ones, and I have not decided > > how to go with those. Either the memset() in vma_init(), or just > > reverting the (imho unnecessary) commit 2c4541e24c55. Kirill, Andrew, > > comments? > > Ugh. Adding a memset looks simple, but screws up some places that have > other initialization. It also requires adding a new include of > , or we'd need to uninline vma_init() and put it > somewhere else. > > But just reverting commit 2c4541e24c55 ("mm: use vma_init() to > initialize VMAs on stack and data segments") entirely isn't good > either, because some of the cases aren't about the TLB flush > interface, and call down to "real" VM functions. The 'pseudo_vma' use > of remove_inode_hugepages() and hugetlbfs_fallocate() in particular is > odd, but using vma_init() looks good there. And those places had the > memset() already. > > So I'm inclined to simply mark the TLB-related vma_init() cases > special, and use something like this: > > #define TLB_FLUSH_VMA(mm,flags) { .vm_mm = (mm), .vm_flags = (flags) } > > to make it very obvious when we're doing that vma initialization for > flush_tlb_range(). It's done as an initializer, exactly so that the > only valid syntax is to do somethin glike this: > > struct vm_area_struct vma = TLB_FLUSH_VMA(mm, VM_EXEC); > > That leaves vma_init() users to be just the actual real allocation > path, and a few very specific specual vmas (the hugetlbfs and > mempolicy pseudo-vma, and a couple of "gate" vmas). > > Suggested patch attached. Comments? Is there a reason why we pass vma to flush_tlb_range? It's not obvious to me what information from VMA can be useful for an implementation. I see that ecard.c initialize vm_flags too, but it seems unused by flush_tlb_range. Maybe it's cleaner to have generic helper flush_tlb_range_mm() or something? In longer term we can change the interface to take mm instead of vma. -- Kirill A. Shutemov