From: Hugh Dickins <hugh@veritas.com>
To: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Andrew Morton <akpm@osdl.org>,
David Howells <dhowells@redhat.com>,
Christoph Lameter <christoph@lameter.com>,
Martin Bligh <mbligh@google.com>, Nick Piggin <npiggin@suse.de>,
Linus Torvalds <torvalds@osdl.org>
Subject: Re: [PATCH 1/5] mm: tracking shared dirty pages
Date: Wed, 28 Jun 2006 18:41:21 +0100 (BST) [thread overview]
Message-ID: <Pine.LNX.4.64.0606281810370.16318@blonde.wat.veritas.com> (raw)
In-Reply-To: <20060627182814.20891.36856.sendpatchset@lappy>
On Tue, 27 Jun 2006, Peter Zijlstra wrote:
> @@ -796,6 +797,44 @@ struct shrinker;
> extern struct shrinker *set_shrinker(int, shrinker_t);
> extern void remove_shrinker(struct shrinker *shrinker);
>
> +#define VM_NOTIFY_NO_PROT 0x01
> +#define VM_NOTIFY_NO_MKWRITE 0x02
> +
> +/*
> + * Some shared mappigns will want the pages marked read-only
> + * to track write events. If so, we'll downgrade vm_page_prot
> + * to the private version (using protection_map[] without the
> + * VM_SHARED bit).
> + */
> +static inline int vma_wants_writenotify(struct vm_area_struct *vma, int flags)
> +{
> + unsigned int vm_flags = vma->vm_flags;
> +
> + /* If it was private or non-writable, the write bit is already clear */
> + if ((vm_flags & (VM_WRITE|VM_SHARED)) != ((VM_WRITE|VM_SHARED)))
> + return 0;
> +
> + /* The backer wishes to know when pages are first written to? */
> + if (!(flags & VM_NOTIFY_NO_MKWRITE) &&
> + vma->vm_ops && vma->vm_ops->page_mkwrite)
> + return 1;
> +
> + /* The open routine did something to the protections already? */
> + if (!(flags & VM_NOTIFY_NO_PROT) &&
> + pgprot_val(vma->vm_page_prot) !=
> + pgprot_val(protection_map[vm_flags &
> + (VM_READ|VM_WRITE|VM_EXEC|VM_SHARED)]))
> + return 0;
Sorry to be such a bore, but this is far from an improvement.
Try to resist adding flags to condition how a function behaves:
there are a million places where it's necessary or accepted, but
avoid it if you reasonably can. And negative flags are particularly
hard to understand ("SKIP" would have been easier than "NO").
Just separate out the pgprot_val check from vma_wants_writenotify,
making that additional test in the case of do_mmap_pgoff. Or if
you prefer, go back to how you had it before, with mprotect_fixup
making sure that that test will succeed.
In the case of page_mkclean, I see no need for vma_wants_writenotify
at all: you're overdesigning for some imaginary use of page_mkclean.
Just apply to the VM_SHARED vmas, with page_mkclean_one saying
if (!pte_dirty(*pte) && !pte_write(*pte))
goto unlock;
Hugh
--
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>
next prev parent reply other threads:[~2006-06-28 17:41 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-06-27 18:28 [PATCH 0/5] mm: tracking dirty pages -v13 Peter Zijlstra
2006-06-27 18:28 ` [PATCH 1/5] mm: tracking shared dirty pages Peter Zijlstra
2006-06-28 0:57 ` Andrew Morton
2006-06-28 19:49 ` Hugh Dickins
2006-06-28 19:58 ` Andrew Morton
2006-06-28 17:41 ` Hugh Dickins [this message]
2006-06-27 18:28 ` [PATCH 2/5] mm: balance " Peter Zijlstra
2006-06-27 18:28 ` [PATCH 3/5] mm: msync() cleanup Peter Zijlstra
2006-06-27 18:28 ` [PATCH 4/5] mm: optimize the new mprotect() code a bit Peter Zijlstra
2006-06-27 18:29 ` [PATCH 5/5] mm: small cleanup of install_page() Peter Zijlstra
-- strict thread matches above, loose matches on Subject: below --
2006-06-23 22:31 [PATCH 0/5] mm: tracking dirty pages -v11 Peter Zijlstra
2006-06-23 22:31 ` [PATCH 1/5] mm: tracking shared dirty pages Peter Zijlstra
2006-06-23 23:54 ` Peter Zijlstra
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=Pine.LNX.4.64.0606281810370.16318@blonde.wat.veritas.com \
--to=hugh@veritas.com \
--cc=a.p.zijlstra@chello.nl \
--cc=akpm@osdl.org \
--cc=christoph@lameter.com \
--cc=dhowells@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mbligh@google.com \
--cc=npiggin@suse.de \
--cc=torvalds@osdl.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox