linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Lance Yang <ioworker0@gmail.com>
To: ioworker0@gmail.com
Cc: 21cnbao@gmail.com, akpm@linux-foundation.org, david@redhat.com,
	fengwei.yin@intel.com, linux-kernel@vger.kernel.org,
	linux-mm@kvack.org, mhocko@suse.com, minchan@kernel.org,
	peterx@redhat.com, ryan.roberts@arm.com, shy828301@gmail.com,
	songmuchun@bytedance.com, wangkefeng.wang@huawei.com,
	xiehuan09@gmail.com, zokeefe@google.com
Subject: Re: [PATCH v7 1/3] mm/madvise: introduce clear_young_dirty_ptes() batch helper
Date: Wed, 17 Apr 2024 13:04:26 +0800	[thread overview]
Message-ID: <20240417050426.66194-1-ioworker0@gmail.com> (raw)
In-Reply-To: <CAK1f24mEoC_Pg7-49G=y7dMUaGhzW11_A5sK0EWVhH6K1kjMMA@mail.gmail.com>

Hey David, Ryan,

How about this change?

static inline void clear_young_dirty_ptes(struct vm_area_struct *vma,
					  unsigned long addr, pte_t *ptep,
					  unsigned int nr, cydp_t flags)
{
	if (flags == CYDP_CLEAR_YOUNG) {
		for (;;) {
			ptep_test_and_clear_young(vma, addr, ptep);
			if (--nr == 0)
				break;
			ptep++;
			addr += PAGE_SIZE;
		}
		return;
	}

	pte_t pte;

	for (;;) {
		pte = ptep_get_and_clear(vma->vm_mm, addr, ptep);

		if (flags & CYDP_CLEAR_YOUNG)
			pte = pte_mkold(pte);
		if (flags & CYDP_CLEAR_DIRTY)
			pte = pte_mkclean(pte);

		if (--nr == 0)
			break;
		ptep++;
		addr += PAGE_SIZE;
	}
}

Thanks,
Lance


  reply	other threads:[~2024-04-17  5:04 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-16  3:34 [PATCH v7 0/3] mm/madvise: enhance lazyfreeing with mTHP in madvise_free Lance Yang
2024-04-16  3:34 ` [PATCH v7 1/3] mm/madvise: introduce clear_young_dirty_ptes() batch helper Lance Yang
2024-04-16 16:25   ` Ryan Roberts
2024-04-17  4:13     ` Lance Yang
     [not found]   ` <a0d9e198-8799-47b9-ac20-8460b984afee@redhat.com>
2024-04-17  4:12     ` Lance Yang
2024-04-17  5:04       ` Lance Yang [this message]
2024-04-17  8:19         ` David Hildenbrand
2024-04-17  9:01           ` Lance Yang
2024-04-17 10:53             ` Ryan Roberts
2024-04-16  3:34 ` [PATCH v7 2/3] mm/arm64: override " Lance Yang
2024-04-16 15:02   ` David Hildenbrand
2024-04-16 16:29   ` Ryan Roberts
2024-04-17  4:16     ` Lance Yang
2024-04-16  3:34 ` [PATCH v7 3/3] mm/madvise: optimize lazyfreeing with mTHP in madvise_free Lance Yang
2024-04-16 16:35   ` Ryan Roberts
2024-04-16 16:52     ` David Hildenbrand
2024-04-17  4:35       ` Lance Yang

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=20240417050426.66194-1-ioworker0@gmail.com \
    --to=ioworker0@gmail.com \
    --cc=21cnbao@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=david@redhat.com \
    --cc=fengwei.yin@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    --cc=minchan@kernel.org \
    --cc=peterx@redhat.com \
    --cc=ryan.roberts@arm.com \
    --cc=shy828301@gmail.com \
    --cc=songmuchun@bytedance.com \
    --cc=wangkefeng.wang@huawei.com \
    --cc=xiehuan09@gmail.com \
    --cc=zokeefe@google.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