Skip to content

core: remove unnecessary tests in sched.c#1306

Merged
LudwigKnuepfer merged 1 commit intoRIOT-OS:masterfrom
Kijewski:issue-19
Jun 18, 2014
Merged

core: remove unnecessary tests in sched.c#1306
LudwigKnuepfer merged 1 commit intoRIOT-OS:masterfrom
Kijewski:issue-19

Conversation

@Kijewski
Copy link
Copy Markdown
Contributor

The scheduling gets activated by kernel_init() calling
cpu_switch_context_exit(). Before this sched_run() won't be called.
When it gets called, at least the main thread and the idle thread are
spawned. The idle thread won't die / get killed. So there always is at
least one thread in runqueue_bitcache.

Closes #19.

The scheduling gets activated by `kernel_init()` calling
`cpu_switch_context_exit()`. Before this `sched_run()` won't be called.
When it gets called, at least the main thread and the idle thread are
spawned. The idle thread won't die / get killed. So there always is at
least one thread in `runqueue_bitcache`.

Closes #19.
@OlegHahm
Copy link
Copy Markdown
Member

I disagree that this closes #19, but I agree that the issue is rather imprecise.

For the change itself: it sounds sensible, but maybe we should put a #ifdef DEVELHELP around it instead of deleting, just in case some kills the idle thread?

@OlegHahm
Copy link
Copy Markdown
Member

btw. the goal was to have less PRs... ;)

@Kijewski
Copy link
Copy Markdown
Contributor Author

btw. the goal was to have less PRs... ;)

Hehe, sometimes you need to open a new PR to close an old one. (Damn, why didn't I study philosophy instead of CS. ;) )

@OlegHahm
Copy link
Copy Markdown
Member

Well, you could argue that computer science is part of mathematics which can be considered as part of philosophy.

@kaspar030
Copy link
Copy Markdown
Contributor

Wow. Where I'm from, philosophy is part of mathematics, not the other way around...

@Kijewski
Copy link
Copy Markdown
Contributor Author

…, just in case some kills the idle thread?

I think sched_task_exit() would be the right place for that.

#ifdef DEVELHELP
    if (sched_active_thread->priority == SCHED_PRIO_LEVELS - 1) {
        core_panic(4711, "Achievement unlocked: Killed the idle thread.");
    }
#endif

@OlegHahm
Copy link
Copy Markdown
Member

hehe, you're probably right - plus I like the error message.

@kaspar030
Copy link
Copy Markdown
Contributor

;)

@Kijewski Kijewski added this to the FIX ME FIRST milestone Jun 12, 2014
@miri64 miri64 modified the milestones: Release NEXT MAJOR, FIX ME FIRST Jun 12, 2014
@mehlis
Copy link
Copy Markdown
Contributor

mehlis commented Jun 14, 2014

@Kijewski can you split this in a style fixup and the actual contribution? open two PRs...

@Kijewski
Copy link
Copy Markdown
Contributor Author

How about no? We don't need PRs for styling fixes.

@OlegHahm
Copy link
Copy Markdown
Member

Agreed concerning styling PRs.

@OlegHahm
Copy link
Copy Markdown
Member

ACK, second missing.

@kaspar030
Copy link
Copy Markdown
Contributor

ACK.

Actually, styling changes should be seperated. They're supereasy to ACK and keep the clutter out of the real diffs. Isn't that even part of the commit guidelines? Just for future PRs...
git add --patch helps seperating the commits.

LudwigKnuepfer pushed a commit that referenced this pull request Jun 18, 2014
core: remove unnecessary tests in sched.c
@LudwigKnuepfer LudwigKnuepfer merged commit 564f980 into RIOT-OS:master Jun 18, 2014
@Kijewski Kijewski deleted the issue-19 branch June 18, 2014 11:25
LudwigKnuepfer pushed a commit to LudwigKnuepfer/RIOT that referenced this pull request Jul 7, 2014
some errors were introduced by RIOT-OS#1306, some existed before
LudwigKnuepfer pushed a commit to LudwigKnuepfer/RIOT that referenced this pull request Jul 7, 2014
some errors were introduced by RIOT-OS#1306, some existed before
LudwigKnuepfer pushed a commit to LudwigKnuepfer/RIOT that referenced this pull request Jul 7, 2014
some errors were introduced by RIOT-OS#1306, some existed before
LudwigKnuepfer pushed a commit to LudwigKnuepfer/RIOT that referenced this pull request Jul 8, 2014
some errors were introduced by RIOT-OS#1306, some existed before
LudwigKnuepfer pushed a commit to LudwigKnuepfer/RIOT that referenced this pull request Jul 11, 2014
some errors were introduced by RIOT-OS#1306, some existed before
LudwigKnuepfer pushed a commit to LudwigKnuepfer/RIOT that referenced this pull request Jul 11, 2014
- Fix (non-)use of thread_*_pid - some errors were introduced by RIOT-OS#1306, some existed before.
- Refactor SCHEDSTATISTICS
- Remove double spaces
- Remove TODOs:
    - MODULE_HWTIMER is not a module anymore
    - checking for NULL is necessary, at least without API changes.
      `sched_task_exit` sets `sched_active_thread` to `NULL`, then exits.
      Afterwards `cpu_switch_context_exit` calls `sched_run`.
- Eradicate MODULE_NSS specific code (*last_pid*)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: core Area: RIOT kernel. Handle PRs marked with this with care! Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Optimize scheduler

6 participants