linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Yan Zhao <yan.y.zhao@intel.com>
To: Suren Baghdasaryan <surenb@google.com>
Cc: David Hildenbrand <david@redhat.com>,
	Matthew Wilcox <willy@infradead.org>,
	Dan Carpenter <dan.carpenter@linaro.org>, <linux-mm@kvack.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	"Liam R. Howlett" <liam.howlett@oracle.com>,
	Laurent Dufour <ldufour@linux.ibm.com>,
	Michel Lespinasse <michel@lespinasse.org>,
	Jerome Glisse <jglisse@google.com>,
	Michal Hocko <mhocko@suse.com>, Vlastimil Babka <vbabka@suse.cz>,
	Johannes Weiner <hannes@cmpxchg.org>,
	Peter Xu <peterx@redhat.com>,
	Dimitri Sivanich <dimitri.sivanich@hpe.com>,
	Mike Travis <mike.travis@hpe.com>,
	Steve Wahl <steve.wahl@hpe.com>
Subject: Re: [bug report] mm: replace vma->vm_flags direct modifications with modifier calls
Date: Tue, 18 Jul 2023 08:27:27 +0800	[thread overview]
Message-ID: <ZLXcb9ueJkFFOAH0@yzhao56-desk.sh.intel.com> (raw)
In-Reply-To: <CAJuCfpEmub1X9AgtM8TAncEekc-g_cQpDZOe38Ckm0-d7PEOSw@mail.gmail.com>

On Mon, Jul 17, 2023 at 09:18:34AM -0700, Suren Baghdasaryan wrote:
> On Sun, Jul 16, 2023 at 11:40 PM Yan Zhao <yan.y.zhao@intel.com> wrote:
> >
> > On Wed, Jul 12, 2023 at 07:48:06PM +0000, Suren Baghdasaryan wrote:
> > > > Would we be able to fix it in stable simply by not triggering the
> > > > vm_flags_set() in case these flags are already set?
> > >
> > > I think we can do that. gru_file_mmap() sets all the flags that are
> > > set by remap_pfn_range_notrack() (VM_IO | VM_PFNMAP | VM_DONTEXPAND |
> > > VM_DONTDUMP), so we can check if all bits are already present and skip
> > > the vm_flags_set() call.
> > >
> > But on x86, remap_pfn_range() also sets flag VM_PAT. (in track_pfn_remap()).
> >
> > Is there any interface to allow device driver to pre-set this flag in .mmap()
> > before .fault()? e.g. export track_pfn_remap() ?
> 
> Driver should be able to call vm_flags_set() in its .mmap().

Do you mean do something like this in .mmap()?

	flags = VM_IO | VM_PFNMAP | VM_DONTEXPAND | VM_DONTDUMP;
	#ifdef CONFIG_X86
	flags |= VM_PAT;
	#endif
	vm_flags_set(vma, flags);

But VM_PAT cannot be set until after a successful reserve_pfn_range(),
which function is again not exported.


  reply	other threads:[~2023-07-18  0:54 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-11  7:21 Dan Carpenter
2023-07-11 21:55 ` Suren Baghdasaryan
2023-07-11 22:21   ` Matthew Wilcox
2023-07-11 23:45     ` Suren Baghdasaryan
2023-07-12  7:35       ` David Hildenbrand
2023-07-12 15:01         ` Suren Baghdasaryan
2023-07-12 15:52           ` Matthew Wilcox
2023-07-12 15:55             ` David Hildenbrand
2023-07-12 16:03               ` Suren Baghdasaryan
2023-07-12 18:49               ` Matthew Wilcox
2023-07-12 18:52                 ` David Hildenbrand
2023-07-12 19:48                   ` Suren Baghdasaryan
2023-07-17  6:13                     ` Yan Zhao
2023-07-17 16:18                       ` Suren Baghdasaryan
2023-07-18  0:27                         ` Yan Zhao [this message]
2023-07-18 16:27                           ` Suren Baghdasaryan
2023-07-12 19:34                 ` Matthew Wilcox
2023-07-17 19:54                   ` Dimitri Sivanich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZLXcb9ueJkFFOAH0@yzhao56-desk.sh.intel.com \
    --to=yan.y.zhao@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=dan.carpenter@linaro.org \
    --cc=david@redhat.com \
    --cc=dimitri.sivanich@hpe.com \
    --cc=hannes@cmpxchg.org \
    --cc=jglisse@google.com \
    --cc=ldufour@linux.ibm.com \
    --cc=liam.howlett@oracle.com \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    --cc=michel@lespinasse.org \
    --cc=mike.travis@hpe.com \
    --cc=peterx@redhat.com \
    --cc=steve.wahl@hpe.com \
    --cc=surenb@google.com \
    --cc=vbabka@suse.cz \
    --cc=willy@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox