linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: xuyiping <xuyiping@hisilicon.com>
To: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>,
	YiPing Xu <xuyiping@huawei.com>
Cc: minchan@kernel.org, ngupta@vflare.org, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org, suzhuangluan@hisilicon.com,
	puck.chen@hisilicon.com, dan.zhao@hisilicon.com
Subject: Re: [PATCH] zsmalloc: drop unused member 'mapping_area->huge'
Date: Wed, 17 Feb 2016 11:29:31 +0800	[thread overview]
Message-ID: <56C3E91B.1030101@hisilicon.com> (raw)
In-Reply-To: <20160217022552.GB535@swordfish>

HI, Sergery

On 2016/2/17 10:26, Sergey Senozhatsky wrote:
> Hello,
>
> On (02/17/16 09:56), YiPing Xu wrote:
>>   static int create_handle_cache(struct zs_pool *pool)
>> @@ -1127,11 +1126,9 @@ static void __zs_unmap_object(struct mapping_area *area,
>>   		goto out;
>>
>>   	buf = area->vm_buf;
>> -	if (!area->huge) {
>> -		buf = buf + ZS_HANDLE_SIZE;
>> -		size -= ZS_HANDLE_SIZE;
>> -		off += ZS_HANDLE_SIZE;
>> -	}
>> +	buf = buf + ZS_HANDLE_SIZE;
>> +	size -= ZS_HANDLE_SIZE;
>> +	off += ZS_HANDLE_SIZE;
>>
>>   	sizes[0] = PAGE_SIZE - off;
>>   	sizes[1] = size - sizes[0];
>
>
> hm, indeed.
>
> shouldn't it depend on class->huge?
>
> void *zs_map_object()
> {

	if (off + class->size <= PAGE_SIZE) {

for huge object, the code will get into this branch, there is no more 
huge object process in __zs_map_object.

		/* this object is contained entirely within a page */
		area->vm_addr = kmap_atomic(page);
		ret = area->vm_addr + off;
		goto out;
	}


> 	void *ret = __zs_map_object(area, pages, off, class->size);
>
> 	if (!class->huge)
> 		ret += ZS_HANDLE_SIZE;  /* area->vm_buf + ZS_HANDLE_SIZE */
>
> 	return ret;
> }

void zs_unmap_object(struct zs_pool *pool, unsigned long handle)
{
	..

	area = this_cpu_ptr(&zs_map_area);
	if (off + class->size <= PAGE_SIZE)

for huge object, the code will get into this branch, so, in 
__zs_unmap_object there is no depend on class->huge.

it is a little implicated here.

		kunmap_atomic(area->vm_addr);
	else {
		struct page *pages[2];

		pages[0] = page;
		pages[1] = get_next_page(page);
		BUG_ON(!pages[1]);

		__zs_unmap_object(area, pages, off, class->size);
	}

	..
}


> static void __zs_unmap_object(struct mapping_area *area...)
> {
> 	char *buf = area->vm_buf;
>
> 	/* handle is in page->private for class->huge */
>
> 	buf = buf + ZS_HANDLE_SIZE;
> 	size -= ZS_HANDLE_SIZE;
> 	off += ZS_HANDLE_SIZE;
>
> 	memcpy(..);
> }
>
> 	-ss
>
> .
>

--
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>

  reply	other threads:[~2016-02-17  3:33 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-17  1:56 YiPing Xu
2016-02-17  2:26 ` Sergey Senozhatsky
2016-02-17  3:29   ` xuyiping [this message]
2016-02-17  3:55     ` Sergey Senozhatsky
2016-02-17  5:20 ` Sergey Senozhatsky
2016-02-17 15:37 ` Minchan Kim

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=56C3E91B.1030101@hisilicon.com \
    --to=xuyiping@hisilicon.com \
    --cc=dan.zhao@hisilicon.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=minchan@kernel.org \
    --cc=ngupta@vflare.org \
    --cc=puck.chen@hisilicon.com \
    --cc=sergey.senozhatsky.work@gmail.com \
    --cc=suzhuangluan@hisilicon.com \
    --cc=xuyiping@huawei.com \
    /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