do_generic_mapping_read 에서 i_size_read함수에 대한 질문입니다. -SMP 관련
do_generic_mapping_read에서 파일의 길이를 받아오기 위해 호출하는 함수 i_size_read입니다.
620 /*
621 * NOTE: in a 32bit arch with a preemptable kernel and
622 * an UP compile the i_size_read/write must be atomic
623 * with respect to the local cpu (unlike with preempt disabled),
624 * but they don't need to be atomic with respect to other cpus like in
625 * true SMP (so they need either to either locally disable irq around
626 * the read or for example on x86 they can be still implemented as a
627 * cmpxchg8b without the need of the lock prefix). For SMP compiles
628 * and 64bit archs it makes no difference if preempt is enabled or not.
629 */
630 static inline loff_t i_size_read(const struct inode *inode)
631 {
632 #if BITS_PER_LONG==32 && defined(CONFIG_SMP)
633 loff_t i_size;
634 unsigned int seq;
635
636 do {
637 seq = read_seqcount_begin(&inode->i_size_seqcount);
638 i_size = inode->i_size;
639 } while (read_seqcount_retry(&inode->i_size_seqcount, seq));
640 return i_size;
641 #elif BITS_PER_LONG==32 && defined(CONFIG_PREEMPT)
642 loff_t i_size;
643
644 preempt_disable();
645 i_size = inode->i_size;
646 preempt_enable();
647 return i_size;
648 #else
649 return inode->i_size;
650 #endif
651 }
632 라인이나 641 라인이나 프로세서가 32비트일 경우에 저런 처리를 해주는데요.
프로세서가 64비트 Dual이나 이럴 경우에 저런 처리가 필요없는 것인가요?
64bit 선점형일때에도 말이예요 'ㅁ' !
그렇다면 왜 그런건지 너무나도 궁금합니다.
-어제부터 계속 이거때문에 신경이 너무 쓰여 글을 올립니다.
이거야원 꿈에서까지 이러고 있으니 ^ ^;
가르침 부탁드리겠습니다.


댓글 달기