Answer to Homework 1

Here is the answer to HW1. Macros are shown in square brackets. Since I told you that you did not need to follow macros there was no need to expand them.

I also said in class that you could ignore SMP code. The following includes the SMP calls, but I have marked most of them.

sys_read
  fget
    fcheck
  locks_verify_area
    [IS_MANDLOCK]
    locks_mandatory_area
      memset
      posix_locks_conflict
        locks_same_owner
        locks_conflict
          locks_overlap
  (*read)
    read_null
  fput
    locks_remove_flock
      locks_delete_lock
        locks_wake_up_blocks
          [wake_up]
          schedule
            [in_interrupt]
            [release_kernel_lock]
            [spin_lock_irq]
            [signal_pending]
            del_from_runqueue
            [idle_task]
            [can_schedule]
              goodness
            [spin_unlock_irq]
            get_cycles   /* okay to ignore SMP code */
            [get_mmu_context]
            [switch_to]
            schedule_tail
              [smp_processor_id]    /* okay to ignore SMP code */
              [idle_task]           /* okay to ignore SMP code */
              reschedule_idle
                [smp_processor_id]  /* okay to ignore smp code */
                [related]
                reschedule_idle_slow
                  /* BEGIN SMP CODE YOU COULD IGNORE */
                  [smp_processor_id]
                  [spin_lock_irqsave]
                  [idle_task]
                  [cpu_curr]
                  cpu_logical_map
                  [cpu_curr]
                  [related]
                  preemption_goodness
                    goodness
                    goodness
                  [spin_unlock_irqrestore]
                  smp_send_reschedule
                    send_IPI_single
                    __save_flags
                    __cli
                    __prepare_ICR2
                    apic_write
                    __prepare_ICR
                    apic_write
                    __restore_flags
                  [spin_unlock_irqrestore]
                  /* END SMP CODE YOU COULD IGNORE */

                  [smp_processor_id]
                  preemption_goodness
                    goodness
                    goodness
              [wmb]
            [reacquire_kernel_lock]
            [spin_unlock_irq]
            [read_lock]
            [for_each_task]
            [read_unlock]
            [spin_lock_irq]
            prev_goodness
              goodness
            do_bottom_half
              [smp_processor_id]
              softirq_trylock
                test_and_set_bit
                atomic_read
                clear_bit  
              [hardirq_trylock]
              __sti
              run_bottom_halves
                [get_active_bhs]
                [clear_active_bhs]
              __cli
              [hardirq_endlock]
              softirq_endlock
                clear_bit
            run_task_queue
              [spin_lock_irqsave]
              [spin_unlock_irqrestore]
            move_last_runqueue
          locks_delete_block
        locks_free_locks
          waitqueue_active
          [panic]
          kfree
            [MAP_NR]
            [PageSlab]
            [SLAB_GET_PAGE_CACHE]
            __kmem_cache_free
              [spin_lock_irqsave]
              [SLAB_BUFCTL]
              [SLAB_GET_PAGE_SLAB]
              [SLAB_STATS_DEC_ACTIVE]
              kmem_poison_obj
                memset
              [spin_unlock_irqrestore]
              kmem_cache_full_free
                kmem_slab_unlink
                kmem_slab_link_end
                [kmem_slab_end]
              kmem_cache_one_free
                kmem_slab_unlink
                kmem_slab_link_free
      lock  /* only if object has lock operation */
    remove_filp
    insert_file_free
  unlock_kernel()