+ } else if (af->pidlist && af->map) {
+ /*
+ * Find pages that reference at least once all of the
+ * given pids and a given mapping
+ */
+ struct pidlist *pid;
+ int matches = 0;
+
+ /*
+ * Check that we reference the given mapping at least
+ * once
+ */
+ list_for_each_entry(ml, &pf->ml, list) {
+ if (ml->map == af->map) {
+ matches++;
+ break;
+ }
+ }
+
+ if (!matches)
+ return;
+ matches = 0;
+
+ /*
+ * Check that we reference all of the given pids
+ * too. The order of the loops is important here. We
+ * must scan through all the references and test for a
+ * given pid. If we would iterate through the
+ * references in the outer loop, we might get
+ * duplicate matches for a pid since it is possible
+ * that a page is mapped multiple times in a process's
+ * addrses space.
+ */
+ list_for_each_entry(pid, af->pidlist, list) {
+ list_for_each_entry(ml, &pf->ml, list) {
+ if (ml->map->pid == pid->pid) {
+ matches++;
+ break;
+ }
+ }
+
+ /*
+ * If we have found as many matches as ther
+ * are pids, we will count the stats
+ */
+ if (matches == af->pids)
+ goto get_stats;
+ }
+ return;