All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Jason Gunthorpe <jgg@ziepe.ca>
Cc: Philip Yang <Philip.Yang@amd.com>,
	Ralph Campbell <rcampbell@nvidia.com>,
	John Hubbard <jhubbard@nvidia.com>,
	Felix.Kuehling@amd.com, dri-devel@lists.freedesktop.org,
	linux-mm@kvack.org, Jerome Glisse <jglisse@redhat.com>,
	Jason Gunthorpe <jgg@mellanox.com>,
	amd-gfx@lists.freedesktop.org, Christoph Hellwig <hch@lst.de>
Subject: Re: [PATCH v2 hmm 4/9] mm/hmm: remove HMM_FAULT_SNAPSHOT
Date: Tue, 24 Mar 2020 08:33:39 +0100	[thread overview]
Message-ID: <20200324073339.GC23447@lst.de> (raw)
In-Reply-To: <20200324011457.2817-5-jgg@ziepe.ca>

>  
> +/*
> + * If the valid flag is masked off, and default_flags doesn't set valid, then
> + * hmm_pte_need_fault() always returns 0.
> + */
> +static bool hmm_can_fault(struct hmm_range *range)
> +{
> +	return ((range->flags[HMM_PFN_VALID] & range->pfn_flags_mask) |
> +		range->default_flags) &
> +	       range->flags[HMM_PFN_VALID];
> +}

So my idea behind the helper was to turn this into something readable :)

E.g.

/*
 * We only need to fault if either the default mask requires to fault all
 * pages, or at least the mask allows for individual pages to be faulted.
 */
static bool hmm_can_fault(struct hmm_range *range)
{
	return ((range->default_flags | range->pfn_flags_mask) &
		range->flags[HMM_PFN_VALID]);
}

In fact now that I managed to destill it down to this I'm not even
sure we really even need the helper, although the comment really helps.
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

WARNING: multiple messages have this Message-ID (diff)
From: Christoph Hellwig <hch@lst.de>
To: Jason Gunthorpe <jgg@ziepe.ca>
Cc: Jerome Glisse <jglisse@redhat.com>,
	Ralph Campbell <rcampbell@nvidia.com>,
	Felix.Kuehling@amd.com, linux-mm@kvack.org,
	John Hubbard <jhubbard@nvidia.com>,
	dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org,
	Christoph Hellwig <hch@lst.de>, Philip Yang <Philip.Yang@amd.com>,
	Jason Gunthorpe <jgg@mellanox.com>
Subject: Re: [PATCH v2 hmm 4/9] mm/hmm: remove HMM_FAULT_SNAPSHOT
Date: Tue, 24 Mar 2020 08:33:39 +0100	[thread overview]
Message-ID: <20200324073339.GC23447@lst.de> (raw)
In-Reply-To: <20200324011457.2817-5-jgg@ziepe.ca>

>  
> +/*
> + * If the valid flag is masked off, and default_flags doesn't set valid, then
> + * hmm_pte_need_fault() always returns 0.
> + */
> +static bool hmm_can_fault(struct hmm_range *range)
> +{
> +	return ((range->flags[HMM_PFN_VALID] & range->pfn_flags_mask) |
> +		range->default_flags) &
> +	       range->flags[HMM_PFN_VALID];
> +}

So my idea behind the helper was to turn this into something readable :)

E.g.

/*
 * We only need to fault if either the default mask requires to fault all
 * pages, or at least the mask allows for individual pages to be faulted.
 */
static bool hmm_can_fault(struct hmm_range *range)
{
	return ((range->default_flags | range->pfn_flags_mask) &
		range->flags[HMM_PFN_VALID]);
}

In fact now that I managed to destill it down to this I'm not even
sure we really even need the helper, although the comment really helps.


  reply	other threads:[~2020-03-24  8:14 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-24  1:14 [PATCH v2 hmm 0/9] Small hmm_range_fault() cleanups Jason Gunthorpe
2020-03-24  1:14 ` Jason Gunthorpe
2020-03-24  1:14 ` Jason Gunthorpe
2020-03-24  1:14 ` [PATCH v2 hmm 1/9] mm/hmm: remove pgmap checking for devmap pages Jason Gunthorpe
2020-03-24  1:14   ` Jason Gunthorpe
2020-03-24  1:14   ` Jason Gunthorpe
2020-03-24  1:14 ` [PATCH v2 hmm 2/9] mm/hmm: return the fault type from hmm_pte_need_fault() Jason Gunthorpe
2020-03-24  1:14   ` Jason Gunthorpe
2020-03-24  1:14   ` Jason Gunthorpe
2020-03-24  7:27   ` Christoph Hellwig
2020-03-24  7:27     ` Christoph Hellwig
2020-03-24 18:58     ` Jason Gunthorpe
2020-03-24 18:58       ` Jason Gunthorpe
2020-03-24 18:58       ` Jason Gunthorpe
2020-03-24  1:14 ` [PATCH v2 hmm 3/9] mm/hmm: remove unused code and tidy comments Jason Gunthorpe
2020-03-24  1:14   ` Jason Gunthorpe
2020-03-24  1:14   ` Jason Gunthorpe
2020-03-24  7:27   ` Christoph Hellwig
2020-03-24  7:27     ` Christoph Hellwig
2020-03-24  1:14 ` [PATCH v2 hmm 4/9] mm/hmm: remove HMM_FAULT_SNAPSHOT Jason Gunthorpe
2020-03-24  1:14   ` Jason Gunthorpe
2020-03-24  1:14   ` Jason Gunthorpe
2020-03-24  7:33   ` Christoph Hellwig [this message]
2020-03-24  7:33     ` Christoph Hellwig
2020-03-24 19:31     ` Jason Gunthorpe
2020-03-24 19:31       ` Jason Gunthorpe
2020-03-24 19:31       ` Jason Gunthorpe
2020-03-24  1:14 ` [PATCH v2 hmm 5/9] mm/hmm: remove the CONFIG_TRANSPARENT_HUGEPAGE #ifdef Jason Gunthorpe
2020-03-24  1:14   ` Jason Gunthorpe
2020-03-24  1:14   ` Jason Gunthorpe
2020-03-24  7:33   ` Christoph Hellwig
2020-03-24  7:33     ` Christoph Hellwig
2020-03-24  1:14 ` [PATCH v2 hmm 6/9] mm/hmm: use device_private_entry_to_pfn() Jason Gunthorpe
2020-03-24  1:14   ` Jason Gunthorpe
2020-03-24  1:14   ` Jason Gunthorpe
2020-03-24  7:34   ` Christoph Hellwig
2020-03-24  7:34     ` Christoph Hellwig
2020-03-24  1:14 ` [PATCH v2 hmm 7/9] mm/hmm: do not unconditionally set pfns when returning EBUSY Jason Gunthorpe
2020-03-24  1:14   ` Jason Gunthorpe
2020-03-24  1:14   ` Jason Gunthorpe
2020-03-24  7:37   ` Christoph Hellwig
2020-03-24  7:37     ` Christoph Hellwig
2020-03-24 15:47     ` Jason Gunthorpe
2020-03-24 15:47       ` Jason Gunthorpe
2020-03-24 15:47       ` Jason Gunthorpe
2020-03-24  1:14 ` [PATCH v2 hmm 8/9] mm/hmm: do not set pfns when returning an error code Jason Gunthorpe
2020-03-24  1:14   ` Jason Gunthorpe
2020-03-24  1:14   ` Jason Gunthorpe
2020-03-24  7:38   ` Christoph Hellwig
2020-03-24  7:38     ` Christoph Hellwig
2020-03-24  1:14 ` [PATCH v2 hmm 9/9] mm/hmm: return error for non-vma snapshots Jason Gunthorpe
2020-03-24  1:14   ` Jason Gunthorpe
2020-03-24  1:14   ` Jason Gunthorpe
2020-03-24  7:45   ` Christoph Hellwig
2020-03-24  7:45     ` Christoph Hellwig
2020-03-26 21:21 ` [PATCH v2 hmm 0/9] Small hmm_range_fault() cleanups Ralph Campbell
2020-03-26 21:21   ` Ralph Campbell
2020-03-26 21:21   ` Ralph Campbell
  -- strict thread matches above, loose matches on Subject: below --
2020-03-27 20:00 [PATCH v3 " Jason Gunthorpe
2020-03-27 20:00 ` [PATCH v2 hmm 4/9] mm/hmm: remove HMM_FAULT_SNAPSHOT Jason Gunthorpe
2020-03-27 20:00   ` Jason Gunthorpe
2020-03-27 20:00   ` Jason Gunthorpe
2020-03-28  8:11   ` Christoph Hellwig
2020-03-28  8:11     ` Christoph Hellwig

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=20200324073339.GC23447@lst.de \
    --to=hch@lst.de \
    --cc=Felix.Kuehling@amd.com \
    --cc=Philip.Yang@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jgg@mellanox.com \
    --cc=jgg@ziepe.ca \
    --cc=jglisse@redhat.com \
    --cc=jhubbard@nvidia.com \
    --cc=linux-mm@kvack.org \
    --cc=rcampbell@nvidia.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.