From: anfei <anfei.zhou@gmail.com>
To: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
linux@arm.linux.org.uk, jamie@shareable.org
Subject: Re: cache alias in mmap + write
Date: Wed, 20 Jan 2010 17:52:42 +0800 [thread overview]
Message-ID: <20100120095242.GA5672@desktop> (raw)
In-Reply-To: <20100120174630.4071.A69D9226@jp.fujitsu.com>
On Wed, Jan 20, 2010 at 06:10:11PM +0900, KOSAKI Motohiro wrote:
> Hello,
>
> > diff --git a/mm/filemap.c b/mm/filemap.c
> > index 96ac6b0..07056fb 100644
> > --- a/mm/filemap.c
> > +++ b/mm/filemap.c
> > @@ -2196,6 +2196,9 @@ again:
> > if (unlikely(status))
> > break;
> >
> > + if (mapping_writably_mapped(mapping))
> > + flush_dcache_page(page);
> > +
> > pagefault_disable();
> > copied = iov_iter_copy_from_user_atomic(page, i, offset, bytes);
> > pagefault_enable();
>
> I'm not sure ARM cache coherency model. but I guess correct patch is here.
>
> + if (mapping_writably_mapped(mapping))
> + flush_dcache_page(page);
> +
> pagefault_disable();
> copied = iov_iter_copy_from_user_atomic(page, i, offset, bytes);
> pagefault_enable();
> - flush_dcache_page(page);
>
>
> Why do we need to call flush_dcache_page() twice?
>
The latter flush_dcache_page is used to flush the kernel changes
(iov_iter_copy_from_user_atomic), which makes the userspace to see the
write, and the one I added is used to flush the userspace changes.
And I think it's better to split this function into two:
flush_dcache_user_page(page);
kmap_atomic(page);
write to page;
kunmap_atomic(page);
flush_dcache_kern_page(page);
But currently there is no such API.
>
>
>
WARNING: multiple messages have this Message-ID (diff)
From: anfei <anfei.zhou@gmail.com>
To: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
linux@arm.linux.org.uk, jamie@shareable.org
Subject: Re: cache alias in mmap + write
Date: Wed, 20 Jan 2010 17:52:42 +0800 [thread overview]
Message-ID: <20100120095242.GA5672@desktop> (raw)
In-Reply-To: <20100120174630.4071.A69D9226@jp.fujitsu.com>
On Wed, Jan 20, 2010 at 06:10:11PM +0900, KOSAKI Motohiro wrote:
> Hello,
>
> > diff --git a/mm/filemap.c b/mm/filemap.c
> > index 96ac6b0..07056fb 100644
> > --- a/mm/filemap.c
> > +++ b/mm/filemap.c
> > @@ -2196,6 +2196,9 @@ again:
> > if (unlikely(status))
> > break;
> >
> > + if (mapping_writably_mapped(mapping))
> > + flush_dcache_page(page);
> > +
> > pagefault_disable();
> > copied = iov_iter_copy_from_user_atomic(page, i, offset, bytes);
> > pagefault_enable();
>
> I'm not sure ARM cache coherency model. but I guess correct patch is here.
>
> + if (mapping_writably_mapped(mapping))
> + flush_dcache_page(page);
> +
> pagefault_disable();
> copied = iov_iter_copy_from_user_atomic(page, i, offset, bytes);
> pagefault_enable();
> - flush_dcache_page(page);
>
>
> Why do we need to call flush_dcache_page() twice?
>
The latter flush_dcache_page is used to flush the kernel changes
(iov_iter_copy_from_user_atomic), which makes the userspace to see the
write, and the one I added is used to flush the userspace changes.
And I think it's better to split this function into two:
flush_dcache_user_page(page);
kmap_atomic(page);
write to page;
kunmap_atomic(page);
flush_dcache_kern_page(page);
But currently there is no such API.
>
>
>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2010-01-20 9:52 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-20 8:26 cache alias in mmap + write anfei
2010-01-20 8:26 ` anfei
2010-01-20 9:10 ` KOSAKI Motohiro
2010-01-20 9:10 ` KOSAKI Motohiro
2010-01-20 9:52 ` anfei [this message]
2010-01-20 9:52 ` anfei
2010-01-21 1:10 ` KOSAKI Motohiro
2010-01-21 1:10 ` KOSAKI Motohiro
2010-01-21 1:32 ` Jamie Lokier
2010-01-21 1:32 ` Jamie Lokier
2010-01-21 3:06 ` anfei zhou
2010-01-21 3:06 ` anfei zhou
2010-01-21 2:39 ` anfei zhou
2010-01-21 2:39 ` anfei zhou
2010-01-21 4:59 ` anfei zhou
2010-01-21 4:59 ` anfei zhou
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=20100120095242.GA5672@desktop \
--to=anfei.zhou@gmail.com \
--cc=jamie@shareable.org \
--cc=kosaki.motohiro@jp.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux@arm.linux.org.uk \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.