Thanks for the query.
Pupil is an aperture in the eye which is dynamic and keeps on changing size according to the surrounding light. It is a natural phenomenon to block the excessive light touching the retina
So don't worry about the size and your headache is also not related to the pupil size.
The swelling which you mentioned can be a mild infection or allergy
You can do some warm compresses for that..