Re: [PATCH 1/2] zsmalloc: do not remap dst page while prepare next src page

2015-03-24 Thread Sergey Senozhatsky
On (03/25/15 14:05), Heesub Shin wrote:
> No, it's not unnecessary. We should do kunmap_atomic() in the reverse
> order of kmap_atomic(), so unfortunately it's inevitable to
> kunmap_atomic() both on d_addr and s_addr.
> 

Andrew, can you please drop this patch?


> > 
> > Signed-off-by: Sergey Senozhatsky 
> > ---
> >  mm/zsmalloc.c | 2 --
> >  1 file changed, 2 deletions(-)
> > 
> > diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c
> > index d920e8b..7af4456 100644
> > --- a/mm/zsmalloc.c
> > +++ b/mm/zsmalloc.c
> > @@ -1536,12 +1536,10 @@ static void zs_object_copy(unsigned long src, 
> > unsigned long dst,
> > break;
> >  
> > if (s_off + size >= PAGE_SIZE) {
> > -   kunmap_atomic(d_addr);
> > kunmap_atomic(s_addr);
> 
> Removing kunmap_atomic(d_addr) here may cause BUG_ON() at __kunmap_atomic().
> 
> I tried yours to see it really happens:
> > kernel BUG at arch/arm/mm/highmem.c:113!

oh, arm. tested on x86_64 only. I see why it happens there. thanks for 
reporting.


sorry, should have checked.

> > Internal error: Oops - BUG: 0 [#1] SMP ARM
> > Modules linked in:
> > CPU: 2 PID: 1774 Comm: bash Not tainted 4.0.0-rc2-mm1+ #105
> > Hardware name: ARM-Versatile Express
> > task: ee971300 ti: e8a26000 task.ti: e8a26000
> > PC is at __kunmap_atomic+0x144/0x14c
> > LR is at zs_object_copy+0x19c/0x2dc

-ss
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/2] zsmalloc: do not remap dst page while prepare next src page

2015-03-24 Thread Heesub Shin
Hello,

On 03/25/2015 12:24 AM, Sergey Senozhatsky wrote:
> object may belong to different pages. zs_object_copy() handles
> this case and maps a new source page (get_next_page() and
> kmap_atomic()) when object crosses boundaries of the current
> source page. But it also performs unnecessary kunmap/kmap_atomic
> of the destination page (it remains unchanged), which can be
> avoided.

No, it's not unnecessary. We should do kunmap_atomic() in the reverse
order of kmap_atomic(), so unfortunately it's inevitable to
kunmap_atomic() both on d_addr and s_addr.

> 
> Signed-off-by: Sergey Senozhatsky 
> ---
>  mm/zsmalloc.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c
> index d920e8b..7af4456 100644
> --- a/mm/zsmalloc.c
> +++ b/mm/zsmalloc.c
> @@ -1536,12 +1536,10 @@ static void zs_object_copy(unsigned long src, 
> unsigned long dst,
>   break;
>  
>   if (s_off + size >= PAGE_SIZE) {
> - kunmap_atomic(d_addr);
>   kunmap_atomic(s_addr);

Removing kunmap_atomic(d_addr) here may cause BUG_ON() at __kunmap_atomic().

I tried yours to see it really happens:
> kernel BUG at arch/arm/mm/highmem.c:113!
> Internal error: Oops - BUG: 0 [#1] SMP ARM
> Modules linked in:
> CPU: 2 PID: 1774 Comm: bash Not tainted 4.0.0-rc2-mm1+ #105
> Hardware name: ARM-Versatile Express
> task: ee971300 ti: e8a26000 task.ti: e8a26000
> PC is at __kunmap_atomic+0x144/0x14c
> LR is at zs_object_copy+0x19c/0x2dc

regards
heesub
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/2] zsmalloc: do not remap dst page while prepare next src page

2015-03-24 Thread Sergey Senozhatsky
object may belong to different pages. zs_object_copy() handles
this case and maps a new source page (get_next_page() and
kmap_atomic()) when object crosses boundaries of the current
source page. But it also performs unnecessary kunmap/kmap_atomic
of the destination page (it remains unchanged), which can be
avoided.

Signed-off-by: Sergey Senozhatsky 
---
 mm/zsmalloc.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c
index d920e8b..7af4456 100644
--- a/mm/zsmalloc.c
+++ b/mm/zsmalloc.c
@@ -1536,12 +1536,10 @@ static void zs_object_copy(unsigned long src, unsigned 
long dst,
break;
 
if (s_off + size >= PAGE_SIZE) {
-   kunmap_atomic(d_addr);
kunmap_atomic(s_addr);
s_page = get_next_page(s_page);
BUG_ON(!s_page);
s_addr = kmap_atomic(s_page);
-   d_addr = kmap_atomic(d_page);
s_size = class->size - written;
s_off = 0;
} else {
-- 
2.3.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/2] zsmalloc: do not remap dst page while prepare next src page

2015-03-24 Thread Sergey Senozhatsky
object may belong to different pages. zs_object_copy() handles
this case and maps a new source page (get_next_page() and
kmap_atomic()) when object crosses boundaries of the current
source page. But it also performs unnecessary kunmap/kmap_atomic
of the destination page (it remains unchanged), which can be
avoided.

Signed-off-by: Sergey Senozhatsky sergey.senozhat...@gmail.com
---
 mm/zsmalloc.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c
index d920e8b..7af4456 100644
--- a/mm/zsmalloc.c
+++ b/mm/zsmalloc.c
@@ -1536,12 +1536,10 @@ static void zs_object_copy(unsigned long src, unsigned 
long dst,
break;
 
if (s_off + size = PAGE_SIZE) {
-   kunmap_atomic(d_addr);
kunmap_atomic(s_addr);
s_page = get_next_page(s_page);
BUG_ON(!s_page);
s_addr = kmap_atomic(s_page);
-   d_addr = kmap_atomic(d_page);
s_size = class-size - written;
s_off = 0;
} else {
-- 
2.3.4

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/2] zsmalloc: do not remap dst page while prepare next src page

2015-03-24 Thread Sergey Senozhatsky
On (03/25/15 14:05), Heesub Shin wrote:
 No, it's not unnecessary. We should do kunmap_atomic() in the reverse
 order of kmap_atomic(), so unfortunately it's inevitable to
 kunmap_atomic() both on d_addr and s_addr.
 

Andrew, can you please drop this patch?


  
  Signed-off-by: Sergey Senozhatsky sergey.senozhat...@gmail.com
  ---
   mm/zsmalloc.c | 2 --
   1 file changed, 2 deletions(-)
  
  diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c
  index d920e8b..7af4456 100644
  --- a/mm/zsmalloc.c
  +++ b/mm/zsmalloc.c
  @@ -1536,12 +1536,10 @@ static void zs_object_copy(unsigned long src, 
  unsigned long dst,
  break;
   
  if (s_off + size = PAGE_SIZE) {
  -   kunmap_atomic(d_addr);
  kunmap_atomic(s_addr);
 
 Removing kunmap_atomic(d_addr) here may cause BUG_ON() at __kunmap_atomic().
 
 I tried yours to see it really happens:
  kernel BUG at arch/arm/mm/highmem.c:113!

oh, arm. tested on x86_64 only. I see why it happens there. thanks for 
reporting.


sorry, should have checked.

  Internal error: Oops - BUG: 0 [#1] SMP ARM
  Modules linked in:
  CPU: 2 PID: 1774 Comm: bash Not tainted 4.0.0-rc2-mm1+ #105
  Hardware name: ARM-Versatile Express
  task: ee971300 ti: e8a26000 task.ti: e8a26000
  PC is at __kunmap_atomic+0x144/0x14c
  LR is at zs_object_copy+0x19c/0x2dc

-ss
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/2] zsmalloc: do not remap dst page while prepare next src page

2015-03-24 Thread Heesub Shin
Hello,

On 03/25/2015 12:24 AM, Sergey Senozhatsky wrote:
 object may belong to different pages. zs_object_copy() handles
 this case and maps a new source page (get_next_page() and
 kmap_atomic()) when object crosses boundaries of the current
 source page. But it also performs unnecessary kunmap/kmap_atomic
 of the destination page (it remains unchanged), which can be
 avoided.

No, it's not unnecessary. We should do kunmap_atomic() in the reverse
order of kmap_atomic(), so unfortunately it's inevitable to
kunmap_atomic() both on d_addr and s_addr.

 
 Signed-off-by: Sergey Senozhatsky sergey.senozhat...@gmail.com
 ---
  mm/zsmalloc.c | 2 --
  1 file changed, 2 deletions(-)
 
 diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c
 index d920e8b..7af4456 100644
 --- a/mm/zsmalloc.c
 +++ b/mm/zsmalloc.c
 @@ -1536,12 +1536,10 @@ static void zs_object_copy(unsigned long src, 
 unsigned long dst,
   break;
  
   if (s_off + size = PAGE_SIZE) {
 - kunmap_atomic(d_addr);
   kunmap_atomic(s_addr);

Removing kunmap_atomic(d_addr) here may cause BUG_ON() at __kunmap_atomic().

I tried yours to see it really happens:
 kernel BUG at arch/arm/mm/highmem.c:113!
 Internal error: Oops - BUG: 0 [#1] SMP ARM
 Modules linked in:
 CPU: 2 PID: 1774 Comm: bash Not tainted 4.0.0-rc2-mm1+ #105
 Hardware name: ARM-Versatile Express
 task: ee971300 ti: e8a26000 task.ti: e8a26000
 PC is at __kunmap_atomic+0x144/0x14c
 LR is at zs_object_copy+0x19c/0x2dc

regards
heesub
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/