From: "Bernatowicz, Marcin" <marcin.bernatowicz@linux.intel.com>
To: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>,
igt-dev@lists.freedesktop.org
Cc: chris.p.wilson@linux.intel.com
Subject: Re: [igt-dev] [PATCH i-g-t 12/14] benchmarks/gem_wsim: extract prepare contexts code to new function
Date: Tue, 26 Sep 2023 13:58:37 +0200 [thread overview]
Message-ID: <d908e6f8-3c51-dde0-3a93-f4a0267c0c76@linux.intel.com> (raw)
In-Reply-To: <b969c855-77b0-7e26-d869-163450d5f621@linux.intel.com>
Hi,
On 9/26/2023 1:43 PM, Tvrtko Ursulin wrote:
>
> On 26/09/2023 09:44, Marcin Bernatowicz wrote:
>> No functional changes.
>> Extracted prepare_contexts function from prepare_workload.
>> Small code cleanup for "No need for 'else' after continue/break". (Kamil)
>>
>> Signed-off-by: Marcin Bernatowicz <marcin.bernatowicz@linux.intel.com>
>> ---
>> benchmarks/gem_wsim.c | 30 ++++++++++++++++++++----------
>> 1 file changed, 20 insertions(+), 10 deletions(-)
>>
>> diff --git a/benchmarks/gem_wsim.c b/benchmarks/gem_wsim.c
>> index 2c6ccd3a9..55f8d9b1b 100644
>> --- a/benchmarks/gem_wsim.c
>> +++ b/benchmarks/gem_wsim.c
>> @@ -1766,20 +1766,13 @@ static void measure_active_set(struct workload
>> *wrk)
>> #define alloca0(sz) ({ size_t sz__ = (sz); memset(alloca(sz__), 0,
>> sz__); })
>> -static int prepare_workload(unsigned int id, struct workload *wrk)
>> +static int prepare_contexts(unsigned int id, struct workload *wrk)
>> {
>> - struct working_set **sets;
>> - unsigned long total = 0;
>> uint32_t share_vm = 0;
>> int max_ctx = -1;
>> struct w_step *w;
>> int i, j;
>> - wrk->id = id;
>> - wrk->bb_prng = (wrk->flags & SYNCEDCLIENTS) ? master_prng : rand();
>> - wrk->bo_prng = (wrk->flags & SYNCEDCLIENTS) ? master_prng : rand();
>> - wrk->run = true;
>> -
>> /*
>> * Pre-scan workload steps to allocate context list storage.
>> */
>> @@ -1968,6 +1961,23 @@ static int prepare_workload(unsigned int id,
>> struct workload *wrk)
>> if (share_vm)
>> vm_destroy(fd, share_vm);
>> + return 0;
>> +}
>> +
>> +static int prepare_workload(unsigned int id, struct workload *wrk)
>> +{
>> + struct working_set **sets;
>> + unsigned long total = 0;
>> + struct w_step *w;
>> + int i, j;
>> +
>> + wrk->id = id;
>> + wrk->bb_prng = (wrk->flags & SYNCEDCLIENTS) ? master_prng : rand();
>> + wrk->bo_prng = (wrk->flags & SYNCEDCLIENTS) ? master_prng : rand();
>> + wrk->run = true;
>> +
>> + prepare_contexts(id, wrk);
>> +
>> /* Record default preemption. */
>> for (i = 0, w = wrk->steps; i < wrk->nr_steps; i++, w++) {
>> if (w->type == BATCH)
>> @@ -1990,9 +2000,9 @@ static int prepare_workload(unsigned int id,
>> struct workload *wrk)
>> if (w2->context != w->context)
>> continue;
>> - else if (w2->type == PREEMPTION)
>> + if (w2->type == PREEMPTION)
>> break;
>> - else if (w2->type != BATCH)
>> + if (w2->type != BATCH)
>
> To me it is more readable like it was. Is this some general rule that
> else if should not be used in such cases?
I'm ok with both, Kamil raised the hand on this, so I modified,
but I don't recall any warnings/errors with this.
Kamil can we live with original version ?
>
> Either case I'd be happiest if extracting code into functions wash't
> mixed with unrelated changes.
>
> Otherwise code extraction looks fine.
>
> Regards,
>
> Tvrtko
>
>> continue;
>> w2->preempt_us = w->period;
next prev parent reply other threads:[~2023-09-26 11:58 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-26 8:44 [igt-dev] [PATCH i-g-t 00/14] [RFC] benchmarks/gem_wsim: added basic xe support Marcin Bernatowicz
2023-09-26 8:44 ` [igt-dev] [PATCH i-g-t 01/14] lib/igt_device_scan: Xe get integrated/discrete card functions Marcin Bernatowicz
2023-09-26 8:44 ` [igt-dev] [PATCH i-g-t 02/14] benchmarks/gem_wsim: reposition the unbound duration boolean Marcin Bernatowicz
2023-09-26 10:23 ` Tvrtko Ursulin
2023-09-26 8:44 ` [igt-dev] [PATCH i-g-t 03/14] benchmarks/gem_wsim: fix scaling of period steps Marcin Bernatowicz
2023-09-26 10:28 ` Tvrtko Ursulin
2023-09-26 8:44 ` [igt-dev] [PATCH i-g-t 04/14] benchmarks/gem_wsim: fix duration range check Marcin Bernatowicz
2023-09-26 10:40 ` Tvrtko Ursulin
2023-09-26 8:44 ` [igt-dev] [PATCH i-g-t 05/14] benchmarks/gem_wsim: extract duration parsing code to new function Marcin Bernatowicz
2023-09-26 10:48 ` Tvrtko Ursulin
2023-09-26 8:44 ` [igt-dev] [PATCH i-g-t 06/14] benchmarks/gem_wsim: fix conflicting SSEU #define and enum Marcin Bernatowicz
2023-09-26 10:51 ` Tvrtko Ursulin
2023-09-26 8:44 ` [igt-dev] [PATCH i-g-t 07/14] benchmarks/gem_wsim: cleanups Marcin Bernatowicz
2023-09-26 11:08 ` Tvrtko Ursulin
2023-09-27 19:03 ` Bernatowicz, Marcin
2023-09-28 8:37 ` Bernatowicz, Marcin
2023-09-26 8:44 ` [igt-dev] [PATCH i-g-t 08/14] benchmarks/gem_wsim: reposition repeat_start variable Marcin Bernatowicz
2023-09-26 11:10 ` Tvrtko Ursulin
2023-09-26 8:44 ` [igt-dev] [PATCH i-g-t 09/14] benchmarks/gem_wsim: use lib code to query engines Marcin Bernatowicz
2023-09-26 11:23 ` Tvrtko Ursulin
2023-09-27 19:09 ` Bernatowicz, Marcin
2023-09-26 8:44 ` [igt-dev] [PATCH i-g-t 10/14] benchmarks/gem_wsim: allow comments in workload description files Marcin Bernatowicz
2023-09-26 11:33 ` Tvrtko Ursulin
2023-09-26 11:48 ` Bernatowicz, Marcin
2023-09-26 12:10 ` Tvrtko Ursulin
2023-09-26 8:44 ` [igt-dev] [PATCH i-g-t 11/14] benchmarks/gem_wsim: introduce w_step_sync function Marcin Bernatowicz
2023-09-26 11:37 ` Tvrtko Ursulin
2023-09-26 8:44 ` [igt-dev] [PATCH i-g-t 12/14] benchmarks/gem_wsim: extract prepare contexts code to new function Marcin Bernatowicz
2023-09-26 11:43 ` Tvrtko Ursulin
2023-09-26 11:58 ` Bernatowicz, Marcin [this message]
2023-09-26 8:44 ` [igt-dev] [PATCH i-g-t 13/14] benchmarks/gem_wsim: extract prepare working sets " Marcin Bernatowicz
2023-09-26 11:46 ` Tvrtko Ursulin
2023-09-26 8:44 ` [igt-dev] [PATCH i-g-t 14/14] benchmarks/gem_wsim: added basic xe support Marcin Bernatowicz
2023-09-26 13:10 ` Tvrtko Ursulin
2023-09-26 18:52 ` Bernatowicz, Marcin
2023-09-27 13:17 ` Tvrtko Ursulin
2023-09-26 10:03 ` [igt-dev] ✓ CI.xeBAT: success for benchmarks/gem_wsim: added basic xe support (rev3) Patchwork
2023-09-26 10:11 ` [igt-dev] ✗ Fi.CI.BAT: failure " Patchwork
2023-09-26 11:56 ` [igt-dev] ✗ Fi.CI.BUILD: failure for benchmarks/gem_wsim: added basic xe support (rev4) 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=d908e6f8-3c51-dde0-3a93-f4a0267c0c76@linux.intel.com \
--to=marcin.bernatowicz@linux.intel.com \
--cc=chris.p.wilson@linux.intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=tvrtko.ursulin@linux.intel.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