linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Jordan <daniel.m.jordan@oracle.com>
To: "Huang, Ying" <ying.huang@intel.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
	Andrea Arcangeli <aarcange@redhat.com>,
	Michal Hocko <mhocko@suse.com>,
	Johannes Weiner <hannes@cmpxchg.org>,
	Shaohua Li <shli@kernel.org>, Hugh Dickins <hughd@google.com>,
	Minchan Kim <minchan@kernel.org>, Rik van Riel <riel@redhat.com>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>,
	Zi Yan <zi.yan@cs.rutgers.edu>
Subject: Re: [PATCH -mm -V3 03/21] mm, THP, swap: Support PMD swap mapping in swap_duplicate()
Date: Tue, 12 Jun 2018 05:04:30 -0700	[thread overview]
Message-ID: <20180612120430.f4wce5hygca5wlhg@ca-dmjordan1.us.oracle.com> (raw)
In-Reply-To: <87o9ggpzlk.fsf@yhuang-dev.intel.com>

On Tue, Jun 12, 2018 at 09:23:19AM +0800, Huang, Ying wrote:
> Daniel Jordan <daniel.m.jordan@oracle.com> writes:
> > #2:  We've masked off SWAP_HAS_CACHE and COUNT_CONTINUED, and already checked
> > for SWAP_MAP_BAD, so I think condition #2 always fails and can just be removed.
> 
> I think this is used to check some software bug.  For example,
> SWAP_MAP_SHMEM will yield true here.

So it does!  And so __swap_duplicate returns -EINVAL in that case, which
swap_shmem_alloc just ignores.  Confusing, and an explicit check for
SWAP_MAP_SHMEM would be cleaner, but why fix what isn't broken.

> 
> >> +#ifdef CONFIG_THP_SWAP
> >> +static int __swap_duplicate_cluster(swp_entry_t *entry, unsigned char usage)
> > ...
> >> +	} else {
> >> +		for (i = 0; i < SWAPFILE_CLUSTER; i++) {
> >> +retry:
> >> +			err = __swap_duplicate_locked(si, offset + i, 1);
> >
> > I guess usage is assumed to be 1 at this point (__swap_duplicate_locked makes
> > the same assumption).  Maybe make this explicit with
> >
> > 			err = __swap_duplicate_locked(si, offset + i, usage);
> >
> > , use 'usage' in cluster_set_count and __swap_entry_free too, and then
> > earlier have a
> >
> >        VM_BUG_ON(usage != SWAP_HAS_CACHE && usage != 1);
> >
> > ?
> 
> Yes.  I will fix this.  And we can just check it in
> __swap_duplicate_locked() and all these will be covered.

I'll respond to your other mail.

> > Not related to your changes, but while we're here, the comment with
> > SWAP_HAS_CONT in swap_count() could be deleted: I don't think there ever was a
> > SWAP_HAS_CONT.
> 
> Yes.  We should correct this.  Because this should go to a separate patch,
> would you mind to submit a patch to fix it?

Sure, I'll do that.

Daniel

  parent reply	other threads:[~2018-06-12 12:05 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-23  8:26 [PATCH -mm -V3 00/21] mm, THP, swap: Swapout/swapin THP in one piece Huang, Ying
2018-05-23  8:26 ` [PATCH -mm -V3 01/21] mm, THP, swap: Enable PMD swap operations for CONFIG_THP_SWAP Huang, Ying
2018-05-23  8:26 ` [PATCH -mm -V3 02/21] mm, THP, swap: Make CONFIG_THP_SWAP depends on CONFIG_SWAP Huang, Ying
2018-05-23  8:26 ` [PATCH -mm -V3 03/21] mm, THP, swap: Support PMD swap mapping in swap_duplicate() Huang, Ying
2018-06-11 20:42   ` Daniel Jordan
2018-06-12  1:23     ` Huang, Ying
2018-06-12  3:15       ` Huang, Ying
2018-06-12 12:05         ` Daniel Jordan
2018-06-12 12:04       ` Daniel Jordan [this message]
2018-06-12 21:44       ` Daniel Jordan
2018-06-13  1:26         ` Huang, Ying
2018-06-13 11:49           ` Daniel Jordan
2018-05-23  8:26 ` [PATCH -mm -V3 04/21] mm, THP, swap: Support PMD swap mapping in swapcache_free_cluster() Huang, Ying
2018-05-23  8:26 ` [PATCH -mm -V3 05/21] mm, THP, swap: Support PMD swap mapping in free_swap_and_cache()/swap_free() Huang, Ying
2018-05-23  8:26 ` [PATCH -mm -V3 06/21] mm, THP, swap: Support PMD swap mapping when splitting huge PMD Huang, Ying
2018-05-23  8:26 ` [PATCH -mm -V3 07/21] mm, THP, swap: Support PMD swap mapping in split_swap_cluster() Huang, Ying
2018-05-23  8:26 ` [PATCH -mm -V3 08/21] mm, THP, swap: Support to read a huge swap cluster for swapin a THP Huang, Ying
2018-05-23  8:26 ` [PATCH -mm -V3 09/21] mm, THP, swap: Swapin a THP as a whole Huang, Ying
2018-05-23  8:26 ` [PATCH -mm -V3 10/21] mm, THP, swap: Support to count THP swapin and its fallback Huang, Ying
2018-05-23  8:26 ` [PATCH -mm -V3 11/21] mm, THP, swap: Add sysfs interface to configure THP swapin Huang, Ying
2018-05-23  8:26 ` [PATCH -mm -V3 12/21] mm, THP, swap: Support PMD swap mapping in swapoff Huang, Ying
2018-05-23  8:26 ` [PATCH -mm -V3 13/21] mm, THP, swap: Support PMD swap mapping in madvise_free() Huang, Ying
2018-05-23  8:26 ` [PATCH -mm -V3 14/21] mm, cgroup, THP, swap: Support to move swap account for PMD swap mapping Huang, Ying
2018-05-23  8:26 ` [PATCH -mm -V3 15/21] mm, THP, swap: Support to copy PMD swap mapping when fork() Huang, Ying
2018-05-23  8:26 ` [PATCH -mm -V3 16/21] mm, THP, swap: Free PMD swap mapping when zap_huge_pmd() Huang, Ying
2018-05-23  8:26 ` [PATCH -mm -V3 17/21] mm, THP, swap: Support PMD swap mapping for MADV_WILLNEED Huang, Ying
2018-05-23  8:26 ` [PATCH -mm -V3 18/21] mm, THP, swap: Support PMD swap mapping in mincore() Huang, Ying
2018-05-23  8:26 ` [PATCH -mm -V3 19/21] mm, THP, swap: Support PMD swap mapping in common path Huang, Ying
2018-05-23  8:26 ` [PATCH -mm -V3 20/21] mm, THP, swap: create PMD swap mapping when unmap the THP Huang, Ying
2018-05-23  8:26 ` [PATCH -mm -V3 21/21] mm, THP: Avoid to split THP when reclaim MADV_FREE THP Huang, Ying
2018-06-01  6:11 ` [PATCH -mm -V3 00/21] mm, THP, swap: Swapout/swapin THP in one piece Naoya Horiguchi
2018-06-01  7:03   ` Huang, Ying
2018-06-04 18:06 ` Daniel Jordan
2018-06-05  4:30   ` Huang, Ying
2018-06-05 16:38     ` Daniel Jordan

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=20180612120430.f4wce5hygca5wlhg@ca-dmjordan1.us.oracle.com \
    --to=daniel.m.jordan@oracle.com \
    --cc=aarcange@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=dave.hansen@linux.intel.com \
    --cc=hannes@cmpxchg.org \
    --cc=hughd@google.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    --cc=minchan@kernel.org \
    --cc=n-horiguchi@ah.jp.nec.com \
    --cc=riel@redhat.com \
    --cc=shli@kernel.org \
    --cc=ying.huang@intel.com \
    --cc=zi.yan@cs.rutgers.edu \
    /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;
as well as URLs for NNTP newsgroup(s).