linux 에서 interrupt 구간에서는 현재 current 가 바뀌나요?

trymp의 이미지

linux kernel 초보입니다.

kernel 에서 current 는 현재 task 에 대한 포인터인 걸로 알고 있습니다.

linux 2.6 SMP 가 적용된 multi core 이고 아래와 같이 돌고 있을 때,

0번 core : A_process
1번 core : B_process
2번 core : C_process
3번 core : D_process

1번 core에서 패킷을 수신해서 NIC interrupt 가 발생한 경우

인터럽트 구간에서 current 를 보면 current->comm 이 B_process 인가요?

current 는 interrupt 구간내에서도 프로세스 컨텍스트의 것으로

그대로 유지가 되나요?

제가 잘 몰라서 고수님들의 조언을 부탁드립니다.

답변주시면 감사하겠습니다.

furmuwon의 이미지

안녕하세요

저도 초보에요..
개발하면서 굉장히 궁금한 부분 이었습니다.
인터럽트 발생하면 현재 current는 어딜까?
인터넷에 검색해도 답변 없고...

경험상

인터럽트 해들러 안에서 current 는 인터럽트 발생 직전의 task(= 인터럽트 핸들러에 의해 선점 되어진) 입니다.
위 질문에서 인터럽트가 0번 cpu 에서 처리 된다면 current 는 A_process 일 것 같구요
NIC interrupt 가 cpu 1번에서 처리 된다면 current 는 B_process 일 것입니다.

어디에 증거 못 들이 밀고 경험상입니다.. ㅎㅎ...

trymp의 이미지

저도 더 열심히 파 봐야겠네요. ㅎㅎ

익명 사용자의 이미지

비슷한 개발을 석사때 한적이 있습니다.

본 글에서 말씀하신대로

1번 core에서 패킷을 수신해서 NIC interrupt 가 발생한 경우

인터럽트 구간에서 current 를 보면 current->comm 이 B_process 입니다.

익명 사용자의 이미지

비슷한 개발을 석사때 한적이 있습니다.

본 글에서 말씀하신대로

1번 core에서 패킷을 수신해서 NIC interrupt 가 발생한 경우

인터럽트 구간에서 current 를 보면 current->comm 이 B_process 입니다.

익명 사용자의 이미지

아참 참고로 Interrupt affinity를 이용하시면 특정 인터럽트는 특정 코어에만 오도록 하실 수 있습니다.

익명 사용자의 이미지

current의 동작을 생각해보면 될것 같네요.
current는 현재 메모리공간의 가장 하단에 있는 프로세스 정보를 반환합니다.

각 프로세스는 자기자신의 메모리 공간을 가지고 있고 상위는 커널로 하위는 유저영역으로 맵핑되어있죠.
프로세스컨텍스트에서는 유저영역을 가리키고있다가 인터럽트가 발생하면 커널영역으로 바뀌는데
둘은 같은 메모리 공간내에 있기 때문에 결국 current는 같은 프로세스 정보를 반환하게 됩니다.

결론은 인터럽트에 진입할때의 프로세스의 정보를 반환하는게 맞습니다.

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.