All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jerome Glisse <j.glisse@gmail.com>
To: GIRISH K S <ks.giri@samsung.com>
Cc: Girish KS <girishks2000@gmail.com>,
	J??e Glisse <jglisse@redhat.com>,
	Christophe Harle <charle@nvidia.com>,
	Mark Hairgrove <mhairgrove@nvidia.com>,
	Dave Airlie <airlied@redhat.com>,
	Arvind Gopalakrishnan <arvindg@nvidia.com>,
	Jatin Kumar <jakumar@nvidia.com>,
	"joro@8bytes.org" <joro@8bytes.org>,
	Greg Stoner <Greg.Stoner@amd.com>,
	"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
	Cameron Buschardt <cabuschardt@nvidia.com>,
	Rik van Riel <riel@redhat.com>,
	Paul Blinzer <Paul.Blinzer@amd.com>,
	Lucien Dunning <ldunning@nvidia.com>,
	Johannes Weiner <jweiner@redhat.com>,
	Haggai Eran <haggaie@mellanox.com>,
	Michael Mantor <Michael.Mantor@amd.com>,
	Laurent Morichetti <Laurent.Morichetti@amd.com>,
	Larry Woodman <lwoodman@redhat.com>,
	John Hubbard <jhubbard@nvidia.com>,
	Brendan Conoboy <blc@redhat.com>,
	John Bridgman <John.Bridgman@amd.com>,
	Subhash Gutti <sgutti@nvidia.com>,
	Roland Dreier <roland@purestorage.com>,
	Duncan Poole <dpoole@nvidia.com>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	Alexander Deucher <Alexander.Deucher@amd.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Andrea Arcangeli <aarcange@redhat.com>,
	Leonid Shamis <Leonid.Shamis@amd.com>,
	Sherry Cheung <SCheung@nvidia.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Shachar Raindel <raindel@mellanox.com>,
	Liran Liss <liranl@mellanox.com>, Ben Sander <ben.sander@amd.com>,
	Joe Donohue <jdonohue@redhat.com>, Mel Gorman <mgorman@suse.de>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Peter Zijlstra <peterz@infradead.org>
Subject: Re: Re: [PATCH 05/15] HMM: introduce heterogeneous memory management v4.
Date: Tue, 4 Aug 2015 10:17:02 -0400	[thread overview]
Message-ID: <20150804141701.GA3511@gmail.com> (raw)
In-Reply-To: <359230388.367691438604474011.JavaMail.weblogic@epmlwas08c>

On Mon, Aug 03, 2015 at 12:21:14PM +0000, GIRISH K S wrote:
> On Mon, Aug 03, 2015 at 01:20:13PM +0530, Girish KS wrote:
> > On 18-Jul-2015 12:47 am, "JA?AE?A?A?A?a??A?A?A?a??A?A 1/2 A?AE?A?A?A?a??A?A?A?a??A?A 1/2 e Glisse" wrote:
> > >
> 
> [...]
> 
> > > +int hmm_mirror_register(struct hmm_mirror *mirror)
> > > +{
> > > +       struct mm_struct *mm = current->mm;
> > > +       struct hmm *hmm = NULL;
> > > +       int ret = 0;
> > > +
> > > +       /* Sanity checks. */
> > > +       BUG_ON(!mirror);
> > > +       BUG_ON(!mirror->device);
> > > +       BUG_ON(!mm);
> > > +
> > > +       /*
> > > +        * Initialize the mirror struct fields, the mlist init and del
> > dance is
> > > +        * necessary to make the error path easier for driver and for hmm.
> > > +        */
> > > +       kref_init(&mirror->kref);
> > > +       INIT_HLIST_NODE(&mirror->mlist);
> > > +       INIT_LIST_HEAD(&mirror->dlist);
> > > +       spin_lock(&mirror->device->lock);
> > > +       list_add(&mirror->dlist, &mirror->device->mirrors);
> > > +       spin_unlock(&mirror->device->lock);
> > > +
> > > +       down_write(&mm->mmap_sem);
> > > +
> > > +       hmm = mm->hmm ? hmm_ref(hmm) : NULL;
> > 
> > Instead of hmm mm->hmm would be the right param to be passed.  Here even
> > though mm->hmm is true hmm_ref returns NULL. Because hmm is not updated
> > after initialization in the beginning.
> 
> ENOPARSE ? While this can be simplified to hmm = hmm_ref(mm->hmm); I do not
> see what you mean. The mm struct might already have a valid hmm field set,
> and that valid hmm struct might also already be in the process of being
> destroy. So hmm_ref() might either return the same hmm pointer if the hmm
> object is not about to be release or NULL. But at this point there is no
> certainty on the return value of hmm_ref().
> 
> I didn't mean hmm = hmm_ref(mm->hmm);. I ll try to put it in a better way.
> The hmm local variable is initialized to NULL in the start of the function
> (struct hmm *hmm = NULL;), and this is not modified till it is passed to
> hmm_ref.  So hmm_ref would always return a NULL irrespective of mm->hmm is
> NULL or valid address.  
> So  the statement hmm = mm->hmm ? hmm_ref(hmm) : NULL; should be replaced
> as hmm = mm->hmm ? hmm_ref(mm->hmm) : NULL;. 

Oh yeah typo probably outcome of many patch reorg i did.

Cheers,
JA(C)rA'me

--
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: Jerome Glisse <j.glisse@gmail.com>
To: GIRISH K S <ks.giri@samsung.com>
Cc: Girish KS <girishks2000@gmail.com>,
	J??e Glisse <jglisse@redhat.com>,
	Christophe Harle <charle@nvidia.com>,
	Mark Hairgrove <mhairgrove@nvidia.com>,
	Dave Airlie <airlied@redhat.com>,
	Arvind Gopalakrishnan <arvindg@nvidia.com>,
	Jatin Kumar <jakumar@nvidia.com>,
	"joro@8bytes.org" <joro@8bytes.org>,
	Greg Stoner <Greg.Stoner@amd.com>,
	"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
	Cameron Buschardt <cabuschardt@nvidia.com>,
	Rik van Riel <riel@redhat.com>,
	Paul Blinzer <Paul.Blinzer@amd.com>,
	Lucien Dunning <ldunning@nvidia.com>,
	Johannes Weiner <jweiner@redhat.com>,
	Haggai Eran <haggaie@mellanox.com>,
	Michael Mantor <Michael.Mantor@amd.com>,
	Laurent Morichetti <Laurent.Morichetti@amd.com>,
	Larry Woodman <lwoodman@redhat.com>,
	John Hubbard <jhubbard@nvidia.com>,
	Brendan Conoboy <blc@redhat.com>,
	John Bridgman <John.Bridgman@amd.com>,
	Subhash Gutti <sgutti@nvidia.com>,
	Roland Dreier <roland@purestorage.com>,
	Duncan Poole <dpoole@nvidia.com>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	Alexander Deucher <Alexander.Deucher@amd.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Andrea Arcangeli <aarcange@redhat.com>,
	Leonid Shamis <Leonid.Shamis@amd.com>,
	Sherry Cheung <SCheung@nvidia.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Shachar Raindel <raindel@mellanox.com>,
	Liran Liss <liranl@mellanox.com>, Ben Sander <ben.sander@amd.com>,
	Joe Donohue <jdonohue@redhat.com>, Mel Gorman <mgorman@suse.de>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Peter Zijlstra <peterz@infradead.org>
Subject: Re: Re: [PATCH 05/15] HMM: introduce heterogeneous memory management v4.
Date: Tue, 4 Aug 2015 10:17:02 -0400	[thread overview]
Message-ID: <20150804141701.GA3511@gmail.com> (raw)
In-Reply-To: <359230388.367691438604474011.JavaMail.weblogic@epmlwas08c>

On Mon, Aug 03, 2015 at 12:21:14PM +0000, GIRISH K S wrote:
> On Mon, Aug 03, 2015 at 01:20:13PM +0530, Girish KS wrote:
> > On 18-Jul-2015 12:47 am, "J��e Glisse" wrote:
> > >
> 
> [...]
> 
> > > +int hmm_mirror_register(struct hmm_mirror *mirror)
> > > +{
> > > +       struct mm_struct *mm = current->mm;
> > > +       struct hmm *hmm = NULL;
> > > +       int ret = 0;
> > > +
> > > +       /* Sanity checks. */
> > > +       BUG_ON(!mirror);
> > > +       BUG_ON(!mirror->device);
> > > +       BUG_ON(!mm);
> > > +
> > > +       /*
> > > +        * Initialize the mirror struct fields, the mlist init and del
> > dance is
> > > +        * necessary to make the error path easier for driver and for hmm.
> > > +        */
> > > +       kref_init(&mirror->kref);
> > > +       INIT_HLIST_NODE(&mirror->mlist);
> > > +       INIT_LIST_HEAD(&mirror->dlist);
> > > +       spin_lock(&mirror->device->lock);
> > > +       list_add(&mirror->dlist, &mirror->device->mirrors);
> > > +       spin_unlock(&mirror->device->lock);
> > > +
> > > +       down_write(&mm->mmap_sem);
> > > +
> > > +       hmm = mm->hmm ? hmm_ref(hmm) : NULL;
> > 
> > Instead of hmm mm->hmm would be the right param to be passed.  Here even
> > though mm->hmm is true hmm_ref returns NULL. Because hmm is not updated
> > after initialization in the beginning.
> 
> ENOPARSE ? While this can be simplified to hmm = hmm_ref(mm->hmm); I do not
> see what you mean. The mm struct might already have a valid hmm field set,
> and that valid hmm struct might also already be in the process of being
> destroy. So hmm_ref() might either return the same hmm pointer if the hmm
> object is not about to be release or NULL. But at this point there is no
> certainty on the return value of hmm_ref().
> 
> I didn't mean hmm = hmm_ref(mm->hmm);. I ll try to put it in a better way.
> The hmm local variable is initialized to NULL in the start of the function
> (struct hmm *hmm = NULL;), and this is not modified till it is passed to
> hmm_ref.  So hmm_ref would always return a NULL irrespective of mm->hmm is
> NULL or valid address.  
> So  the statement hmm = mm->hmm ? hmm_ref(hmm) : NULL; should be replaced
> as hmm = mm->hmm ? hmm_ref(mm->hmm) : NULL;. 

Oh yeah typo probably outcome of many patch reorg i did.

Cheers,
Jérôme

  reply	other threads:[~2015-08-04 14:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-03 12:21 Re: [PATCH 05/15] HMM: introduce heterogeneous memory management v4 GIRISH K S
2015-08-03 12:21 ` GIRISH K S
2015-08-04 14:17 ` Jerome Glisse [this message]
2015-08-04 14:17   ` Jerome Glisse

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=20150804141701.GA3511@gmail.com \
    --to=j.glisse@gmail.com \
    --cc=Alexander.Deucher@amd.com \
    --cc=Greg.Stoner@amd.com \
    --cc=John.Bridgman@amd.com \
    --cc=Laurent.Morichetti@amd.com \
    --cc=Leonid.Shamis@amd.com \
    --cc=Michael.Mantor@amd.com \
    --cc=Paul.Blinzer@amd.com \
    --cc=SCheung@nvidia.com \
    --cc=aarcange@redhat.com \
    --cc=airlied@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=arvindg@nvidia.com \
    --cc=ben.sander@amd.com \
    --cc=blc@redhat.com \
    --cc=cabuschardt@nvidia.com \
    --cc=charle@nvidia.com \
    --cc=dpoole@nvidia.com \
    --cc=girishks2000@gmail.com \
    --cc=haggaie@mellanox.com \
    --cc=hpa@zytor.com \
    --cc=jakumar@nvidia.com \
    --cc=jdonohue@redhat.com \
    --cc=jglisse@redhat.com \
    --cc=jhubbard@nvidia.com \
    --cc=joro@8bytes.org \
    --cc=jweiner@redhat.com \
    --cc=ks.giri@samsung.com \
    --cc=ldunning@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=liranl@mellanox.com \
    --cc=lwoodman@redhat.com \
    --cc=mgorman@suse.de \
    --cc=mhairgrove@nvidia.com \
    --cc=peterz@infradead.org \
    --cc=raindel@mellanox.com \
    --cc=riel@redhat.com \
    --cc=roland@purestorage.com \
    --cc=sgutti@nvidia.com \
    --cc=torvalds@linux-foundation.org \
    /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.