All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Sasha Levin <sasha.levin@oracle.com>
Cc: Hugh Dickins <hughd@google.com>, Michal Hocko <mhocko@suse.cz>,
	Konstantin Khlebnikov <khlebnikov@openvz.org>,
	Mel Gorman <mgorman@suse.de>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Sasha Levin <levinsasha928@gmail.com>
Subject: Re: [PATCH v2] mm,ksm: use new hashtable implementation
Date: Fri, 21 Dec 2012 13:36:10 -0800	[thread overview]
Message-ID: <20121221133610.bb516813.akpm@linux-foundation.org> (raw)
In-Reply-To: <1356112012-24584-1-git-send-email-sasha.levin@oracle.com>

On Fri, 21 Dec 2012 12:46:50 -0500
Sasha Levin <sasha.levin@oracle.com> wrote:

> Switch ksm to use the new hashtable implementation. This reduces the amount of
> generic unrelated code in the ksm module.

hm, include/linux/hashtable.h:hash_min() is rather dangerous - it
returns different values depending on the size of the first argument. 
So if the calling code mixes up its ints and longs (and boy we do that
a lot), the result will work on 32-bit and fail on 64-bit.

Also, is there ever likely to be a situation where the first arg to
hash_min() is *not* a pointer?  Perhaps it would be better to concede
to reality: rename `key' to `ptr' and remove all those typcasts you
just added.

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

WARNING: multiple messages have this Message-ID (diff)
From: Andrew Morton <akpm@linux-foundation.org>
To: Sasha Levin <sasha.levin@oracle.com>
Cc: Hugh Dickins <hughd@google.com>, Michal Hocko <mhocko@suse.cz>,
	Konstantin Khlebnikov <khlebnikov@openvz.org>,
	Mel Gorman <mgorman@suse.de>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Sasha Levin <levinsasha928@gmail.com>
Subject: Re: [PATCH v2] mm,ksm: use new hashtable implementation
Date: Fri, 21 Dec 2012 13:36:10 -0800	[thread overview]
Message-ID: <20121221133610.bb516813.akpm@linux-foundation.org> (raw)
In-Reply-To: <1356112012-24584-1-git-send-email-sasha.levin@oracle.com>

On Fri, 21 Dec 2012 12:46:50 -0500
Sasha Levin <sasha.levin@oracle.com> wrote:

> Switch ksm to use the new hashtable implementation. This reduces the amount of
> generic unrelated code in the ksm module.

hm, include/linux/hashtable.h:hash_min() is rather dangerous - it
returns different values depending on the size of the first argument. 
So if the calling code mixes up its ints and longs (and boy we do that
a lot), the result will work on 32-bit and fail on 64-bit.

Also, is there ever likely to be a situation where the first arg to
hash_min() is *not* a pointer?  Perhaps it would be better to concede
to reality: rename `key' to `ptr' and remove all those typcasts you
just added.


  reply	other threads:[~2012-12-21 21:36 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-21 17:46 [PATCH v2] mm,ksm: use new hashtable implementation Sasha Levin
2012-12-21 17:46 ` Sasha Levin
2012-12-21 21:36 ` Andrew Morton [this message]
2012-12-21 21:36   ` Andrew Morton
2012-12-21 21:59   ` Sasha Levin
2012-12-21 21:59     ` Sasha Levin

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=20121221133610.bb516813.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=hughd@google.com \
    --cc=khlebnikov@openvz.org \
    --cc=levinsasha928@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@suse.de \
    --cc=mhocko@suse.cz \
    --cc=sasha.levin@oracle.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 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.