From: "Yokoyama, Caz" <caz.yokoyama@intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>
Cc: igt-dev@lists.freedesktop.org
Subject: [igt-dev] FW: [PATCH i-g-t] lib: Incrementally mlock()
Date: Tue, 26 Feb 2019 09:42:51 -0800 [thread overview]
Message-ID: <f79ec9109d2175506a96e1bcb2bdd7aca3ee0b90.camel@intel.com> (raw)
In-Reply-To: <20190219222110.19815-1-chris@chris-wilson.co.uk>
Chris,
I am OK to give "Reviewed by: XXXX" to your patch.
However, I want to add following comment/modification which does not
affect the effect of your patch.
+ /*
+ * This is a bug which mlocks far
beyond memory,
+ * i.e. there is a hole between 3/4 of
avail and
+ * (bytes * sizeof(*can_mlock)) where
+ * sizeof(*can_mlock)=8. Because of the
hole, mlock()
+ * may fail and get out of while loop.
+ * However, We need the hole. Otherwise
OOM kills parent
+ * process. Another mlock() below is
same.
+ */
+ if (mlock((void *)can_mlock + (bytes *
sizeof(*can_mlock)),
+ inc))
break;
-caz
P.S. Sorry for not clean thread sequence. I lost mails.
-----Original Message-----
From: igt-dev [mailto:igt-dev-bounces@lists.freedesktop.org] On Behalf
Of Chris Wilson
Sent: Tuesday, February 19, 2019 14:21
To: igt-dev@lists.freedesktop.org
Cc: Caz Yokoyama <caz@caz-nuc.ra.intel.com>
Subject: [igt-dev] [PATCH i-g-t] lib: Incrementally mlock()
As we already have the previous portion of the mmap mlocked, we only
need to mlock() the fresh portion for testing available memory.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Caz Yokoyama <caz@caz-nuc.ra.intel.com>
---
lib/intel_os.c | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/lib/intel_os.c b/lib/intel_os.c index e1e31e230..961442a0d
100644
--- a/lib/intel_os.c
+++ b/lib/intel_os.c
@@ -250,22 +250,24 @@ intel_get_total_pinnable_mem(void)
}
for (uint64_t inc = 1024 << 20; inc >= 4 << 10; inc >>= 2) {
- igt_debug("Testing mlock %'"PRIu64" B (%'"PRIu64"
MiB)\n",
- *can_mlock, *can_mlock >> 20);
+ uint64_t locked = *can_mlock;
+
+ igt_debug("Testing mlock %'"PRIu64"B (%'"PRIu64"MiB) +
%'"PRIu64"B\n",
+ locked, locked >> 20, inc);
igt_fork(child, 1) {
- for (uint64_t bytes = *can_mlock;
- bytes <= pin;
- bytes += inc) {
- if (mlock(can_mlock, bytes))
+ uint64_t bytes = *can_mlock;
+
+ while (bytes <= pin) {
+ if (mlock(can_mlock + bytes, inc))
break;
- *can_mlock = bytes;
+ *can_mlock = bytes += inc;
__sync_synchronize();
}
}
__igt_waitchildren();
- igt_assert(!mlock(can_mlock, *can_mlock));
+ igt_assert(!mlock(can_mlock + locked, *can_mlock -
locked));
}
out:
--
2.20.1
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
next prev parent reply other threads:[~2019-02-26 17:36 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-20 1:13 [igt-dev] [igt PATCH 0/1] lib: igt@i915_suspend@shrink faster Caz Yokoyama
2019-02-19 19:05 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2019-02-19 22:37 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2019-02-19 22:49 ` [igt-dev] ✓ Fi.CI.BAT: success for lib: igt@i915_suspend@shrink faster (rev2) Patchwork
2019-02-20 0:53 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2019-02-20 1:13 ` [igt-dev] [igt PATCH 1/1] igt@i915_suspend@shrink faster Caz Yokoyama
2019-02-19 22:21 ` [igt-dev] [PATCH i-g-t] lib: Incrementally mlock() Chris Wilson
2019-02-20 5:26 ` Ashutosh Dixit
2019-02-20 5:39 ` Ashutosh Dixit
2019-02-20 22:28 ` Caz Yokoyama
2019-02-26 17:42 ` Yokoyama, Caz [this message]
2019-02-26 17:42 ` [igt-dev] FW: " Chris Wilson
2019-02-26 20:34 ` Caz Yokoyama
2019-02-26 21:31 ` Chris Wilson
2019-02-27 0:40 ` Caz Yokoyama
2019-02-27 8:13 ` Chris Wilson
2019-02-20 3:14 ` [igt-dev] [igt PATCH 1/1] igt@i915_suspend@shrink faster Ashutosh Dixit
2019-02-26 17:56 ` [igt-dev] ✗ Fi.CI.BAT: failure for lib: igt@i915_suspend@shrink faster (rev3) Patchwork
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=f79ec9109d2175506a96e1bcb2bdd7aca3ee0b90.camel@intel.com \
--to=caz.yokoyama@intel.com \
--cc=chris@chris-wilson.co.uk \
--cc=igt-dev@lists.freedesktop.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