pf(4) has the notion of full ruleset changes when you reload from pfctl utility and provides other mechanics for modifying the live ruleset.
The write semantics are not required during preparation of loading a full ruleset but only during commit phase.
This change reduces the overhead of reloading a full ruleset with regard to packets being processed by the host.
Though more work is required in breaking down the locks to specific rulesets since ALTQ, tables, route-to/reply-to, anchors provide the same overhead.
Also this patch fixes some possible memory leaks on rules without existing interfaces.