Linux: The difference between “paging on major page fault” and “swapping enabled manually”
There is still majflt which will trigger paging out data to the disk.
It’s the other way round: major fault are page faults which can only be addressed by paging in data from a disk.
Can we say there are two types of swapping on the OS?
Not quite; the distinction here is that paging out (copying the content of memory “somewhere else” so pages can be discarded) can use different backing stores. Pages in memory have different targets for paging out: mapped files are typically their own backing store, most other pages need a swap file or partition as backing store. Swapping refers to the latter. When the kernel needs to free a page of memory, if it wants to free an unmodified page from a file it can simply discard it, knowing that the page can be restored from the file whenever it’s needed. When it needs to discard a modified page from a file, if that file is mapped read/write with no sharing, the page will be written to the file before being discarded; again, the kernel then knows it can restore the page from the file. Anything else needs some other form of storage, or it can’t be discarded.
How do the two mechanisms work differently?
See above.
If there is always a paging mechanism working, why is there still a need to enable swap manually?
See above, mostly. The point of swap is to provide a backing store for pages which don’t have their own backing store already.
See also Why does Linux need swap space in a VM?