Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1233187 > unrolled thread
| Started by | Vladimir Davydov <vdavydov@parallels.com> |
|---|---|
| First post | 2015-09-26 12:50 +0200 |
| Last post | 2015-09-30 19:00 +0200 |
| Articles | 3 — 3 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH 2/5] fs: charge pipe buffers to memcg Vladimir Davydov <vdavydov@parallels.com> - 2015-09-26 12:50 +0200
Re: [PATCH 2/5] fs: charge pipe buffers to memcg Andrew Morton <akpm@linux-foundation.org> - 2015-09-30 01:00 +0200
Re: [PATCH 2/5] fs: charge pipe buffers to memcg Vladimir Davydov <vdavydov@virtuozzo.com> - 2015-09-30 19:00 +0200
| From | Vladimir Davydov <vdavydov@parallels.com> |
|---|---|
| Date | 2015-09-26 12:50 +0200 |
| Subject | [PATCH 2/5] fs: charge pipe buffers to memcg |
| Message-ID | <qcVdg-5WW-7@gated-at.bofh.it> |
Pipe buffers can be generated unrestrictedly by an unprivileged
userspace process, so they shouldn't go unaccounted.
Signed-off-by: Vladimir Davydov <vdavydov@parallels.com>
---
fs/pipe.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/pipe.c b/fs/pipe.c
index 8865f7963700..6880884b70b0 100644
--- a/fs/pipe.c
+++ b/fs/pipe.c
@@ -400,7 +400,7 @@ pipe_write(struct kiocb *iocb, struct iov_iter *from)
int copied;
if (!page) {
- page = alloc_page(GFP_HIGHUSER);
+ page = alloc_kmem_pages(GFP_HIGHUSER, 0);
if (unlikely(!page)) {
ret = ret ? : -ENOMEM;
break;
--
2.1.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | Andrew Morton <akpm@linux-foundation.org> |
|---|---|
| Date | 2015-09-30 01:00 +0200 |
| Message-ID | <qec2m-3qN-1@gated-at.bofh.it> |
| In reply to | #1233187 |
On Sat, 26 Sep 2015 13:45:54 +0300 Vladimir Davydov <vdavydov@parallels.com> wrote:
> Pipe buffers can be generated unrestrictedly by an unprivileged
> userspace process, so they shouldn't go unaccounted.
>
> ...
>
> --- a/fs/pipe.c
> +++ b/fs/pipe.c
> @@ -400,7 +400,7 @@ pipe_write(struct kiocb *iocb, struct iov_iter *from)
> int copied;
>
> if (!page) {
> - page = alloc_page(GFP_HIGHUSER);
> + page = alloc_kmem_pages(GFP_HIGHUSER, 0);
> if (unlikely(!page)) {
> ret = ret ? : -ENOMEM;
> break;
This seems broken. We have a page buffer page which has a weird
->mapcount. Now it gets stolen (generic_pipe_buf_steal()) and spliced
into pagecache. Then the page gets mmapped and MM starts playing with
its ->_mapcount?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Vladimir Davydov <vdavydov@virtuozzo.com> |
|---|---|
| Date | 2015-09-30 19:00 +0200 |
| Message-ID | <qesTw-2qP-1@gated-at.bofh.it> |
| In reply to | #1235623 |
On Tue, Sep 29, 2015 at 03:57:11PM -0700, Andrew Morton wrote:
> On Sat, 26 Sep 2015 13:45:54 +0300 Vladimir Davydov <vdavydov@parallels.com> wrote:
>
> > Pipe buffers can be generated unrestrictedly by an unprivileged
> > userspace process, so they shouldn't go unaccounted.
> >
> > ...
> >
> > --- a/fs/pipe.c
> > +++ b/fs/pipe.c
> > @@ -400,7 +400,7 @@ pipe_write(struct kiocb *iocb, struct iov_iter *from)
> > int copied;
> >
> > if (!page) {
> > - page = alloc_page(GFP_HIGHUSER);
> > + page = alloc_kmem_pages(GFP_HIGHUSER, 0);
> > if (unlikely(!page)) {
> > ret = ret ? : -ENOMEM;
> > break;
>
> This seems broken. We have a page buffer page which has a weird
> ->mapcount. Now it gets stolen (generic_pipe_buf_steal()) and spliced
> into pagecache. Then the page gets mmapped and MM starts playing with
> its ->_mapcount?
Right you are! I completely forgot of vmsplice case. Surely, we need to
uncharge the page in the ->steal method and clear its PageKmem. Will fix
that.
Thanks,
Vladimir
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web